On 11/2/21 6:03 AM, Florian Wetschoreck wrote:

Hello everyone:

The scenario/observation:
Beginners sometimes create scripts with the name of a package e.g. pandas.py or seaborn.py in order to test something.

There's a previous discussion about preventing importing a file into itself. It's a common beginner mistake: "I want to try out the random module, I will name my test program random.py".  Then they get a baffling error: "AttributeError: module 'random' has no attribute 'shuffle'".   If we make the actual error more apparent ("ImportError: module 'random' imported itself"), we might nip this error in the bud.

Thread: https://mail.python.org/archives/list/python-ideas@python.org/thread/XJIEQQ7FCTNVKB7SMRQS2IJSSANRDU26/#QOL54FGEDKYGX5J4UMBAUR74PGS3HEPD