On 07/05/2016 05:50 AM, Chris Angelico wrote: > On Tue, Jul 5, 2016 at 9:33 PM, Peter Otten <__pete...@web.de> wrote: >> Chris Angelico wrote: >> >>> On Tue, Jul 5, 2016 at 6:36 PM, Peter Otten <__pete...@web.de> wrote: >>>> What will >>>> >>>> $ cat foo.py >>>> import foo >>>> class A: pass >>>> print(isinstance(foo.A(), A)) >>>> $ python -c 'import foo' >>>> ... >>>> $ python foo.py >>>> ... >>>> >>>> print? [snip] >> The intended lesson was that there may be two distinct classes >> >> __main__.A and foo.A [snip] > The two distinct classes problem is a very real one, and comes of > circular (or not-technically-circular, as in the second case) imports.
It can also come of pathological setups where a path and its parent are both on sys.path, so all import paths have an "optional" prefix (but you actually get a different copy of the module depending on whether you use that prefix). Carl
signature.asc
Description: OpenPGP digital signature
-- https://mail.python.org/mailman/listinfo/python-list