Pyenos wrote:
> class One:
>         Two() #can't instantiate
> class Two:
>         Three() #can't instantiate
> class Three:pass

Python parses code from top to bottom.
Since it first tries to read the class One and finds the class Two
inside it, it throws an error since it is not defined yet.

Reverse the order and it will work (like this:)

class Three:pass
class Two:
        Three()
class One:
        Two()

Of course this makes no sense whatsoever as the poster above me wrote.
The reason that you can use classes in the order the second poster
wrote is because of init not being called until you make an instance of
that class, and by then all classes are loaded.

/buffi (buffis.com)

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to