Optimizing methods away or not?

James Stroud jstroud at mbi.ucla.edu
Sun Dec 14 09:00:03 CET 2008

Steven D'Aprano wrote:
> class Parrot:
>     def __init__(self, *args):
>         print "Initialising instance..."
>         if __debug__:
>             self.verify()  # check internal program state, not args
>     if __debug__:
>         def verify(self):
>             print "Verifying..."

+1 It looks good to me and the intent is much clearer than the other.

More information about the Python-list mailing list