Recursive method
Fredrik Lundh
fredrik at pythonware.com
Wed Jul 14 11:44:14 EDT 1999
More information about the Python-list mailing list
Wed Jul 14 11:44:14 EDT 1999
- Previous message (by thread): Recursive method
- Next message (by thread): Recursive method
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Ralph Gauges <ralph.gauges at eml.villa-bosch.de> wrote: > > probably because there is no instance when the > > class definition is executed... > > > > ("class" is a *statement*, not a declaration, and > > is executed when the script is run. see: > > http://www.python.org/doc/current/ref/class.html > > for details. "def" is also a statement, btw...) > > > > </F> > > This sounds right, but when I have a class that pops up a > gui on my screen, as I do now, it doesn't seem to make much > difference, wether I build the gui right in the class > definition or in the __init__ method. Both is executed when > I make an Instance nope. try running this script to see what's going on: ... class Foo: print "this is executed when the class statement is executed" def __init__(self): print "this is executed when a new instance is created" foo = Foo() ... next, try removing the "foo = Foo()" line and run it again. finally, try adding multiple copies of "foo = Foo()" and run it. get it? </F>
- Previous message (by thread): Recursive method
- Next message (by thread): Recursive method
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list