[Python-ideas] Statement local functions and classes (aka PEP 3150 is dead, say 'Hi!' to PEP 403)

Ron Adam ron3200 at gmail.com
Fri Oct 14 18:30:38 CEST 2011


On Fri, 2011-10-14 at 20:03 +1300, Greg Ewing wrote:
> Ron Adam wrote:
> 
> > Class's are constructed top down.  You create the framework and then
> > fill in the parts.
> 
> Actually, they're not -- the class object is created
> *after* executing the class body! So this is a (small)
> precedent for writing things out of order when it
> helps.

I fairly often will write classes by writing the class header, then
write the methods headers, and then go back and fill in the method
bodies.  The mental model for solving a problem doesn't have to match
the exact computational order.

Cheers,
   Ron


 





More information about the Python-ideas mailing list