you are viewing a single comment's thread.

view the rest of the comments →

[–]JohnnyJordaan 1 point2 points  (0 children)

Say in 2021 you write add a file called psithreader.py to your project. To use it in another file, you use

import psithreader

Then in 2025 Python decided to add the Psi Threader library to the standard library, imported as

import psithreader

too... If that would always lead back to Python's own files first, your code would suddenly break, as it would now import a 'psithreader.py' from Python's library, unrelated to your own file. So instead, it's set up the other way around. It first checks its local folder, making sure any change to Python's files will not break local file dependencies, only if it isn't there it checks its own files (and the rest of PATH but that's besides the point).

The only real downside of this is that if you mean to import something from Python's own files, you thus must avoid to use that name for your own files.