3 ms·
Looks like people thought "." refers to the filesystem CWD instead of the current package. Python never made shell constructs that central. Admittedly, it nev
by mixmastamyk 4y ago
Looks like people thought "." refers to the filesystem CWD instead of the current package. Python never made shell constructs that central. Admittedly, it never occurred to me to confuse these two, and so haven't had any of the problems any of those folks mention.
And you need (maybe used to?) an __init__.py file in each package.
But once you know that, it's straightforward, no? Certainly not, "only a few people in the world know this..." level. Don't think I'm some kinda level-10 genius here.
- IshKebab 4y ago> Looks like people thought "." refers to the filesystem CWD instead of the current package. Yes because referring to the filesystem is logical and intuitive and referring to some abstract "package" that changes depending on how you invoke Python is insane. > But once you know that, it's straightforward, no? I wish!
- mixmastamyk 4y agoIt's a programming language, not a shell, of course. It has always been strict about syntax as well. I don't expect "&" or ">" to work the same in the shell as I do in Python—why would I expect "." to? Close to none of the notation of Python works the same as a shell. Even quotes, which are superficially similar but have significant differences. > abstract "package" Packages are not abstract, they are simply a folder with .py files inside. Sounds concrete enough to me. > changes depending on how you invoke Python I'm not sure what this refers to? I know you can change PYTHONPATH. And the current folder portion changes with it.