I noticed some different (strange) behaviour when handling projects like that.
Imagine following folder structure
# project_folder
# a_submodule
* a.py
* b.py
* __init__.py
* main.py
- content a.py:
class Foo:
pass
- content b.py:
from a import Foo
foo = Foo()
content main.py:
from os.path import join as pjoin
import os
import sys
# put a_submodule into path
curr_dir = os.path.abspath(os.path.dirname(__file__))
sys.path.append(pjoin(curr_dir, 'a_submodule'))
# import them using two different ways (1: directly, 2: resolving through path)
from a_submodule.b import foo as instance_1
from b import foo as instance_2
assert instance_1 is instance_2, "Instances are not the same" # will raise(!)
is it intended that a different input mechanism results in completely ignoring
the files as being the same. Python does not seem to understand that it already
imported a thing when the import statement differs.
I noticed that in my code when suddenly Enums where different while being the
same depending on which code part they where executed from. That brings me to a
point where I cannot handle the project like this at all in that manner :/
_______________________________________________
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at
https://mail.python.org/archives/list/[email protected]/message/LULH2LZQBUEY7ARMGOMFLDEEPTO5AU3Y/
Code of Conduct: http://python.org/psf/codeofconduct/