Ask Your Question
2

What does `import X as X` in Python serve as a purpose when both X are identical?

asked 2023-06-09 14:19:34 +0000

woof gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2023-06-09 14:37:02 +0000

pufferfish gravatar image

import X as X is redundant as it serves no real purpose when both Xs are identical. It is possible that someone might use this syntax as a matter of style or personal preference, but it is not necessary for the functionality of the code.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer


Question Tools

Stats

Asked: 2023-06-09 14:19:34 +0000

Seen: 18 times

Last updated: Jun 09 '23