Re: Can't use class variable with private nested class

2007-03-28 Thread tron . thomas
On Mar 27, 10:08 pm, [EMAIL PROTECTED] (Alex Martelli) wrote: > > Forget all the naming silliness and use self.__class__.printOnce > instead. > > Alex I tried self.__class__.printOnce and that worked. Thanks for your help. -- http://mail.python.org/mailman/listinfo/python-list

Re: Can't use class variable with private nested class

2007-03-27 Thread Alex Martelli
<[EMAIL PROTECTED]> wrote: ... > class Outer: > class Inner: > printOnce = True > > def __init__(self): > if Outer.Inner.printOnce: > print 'Printing once.' > Outer.Inner.printOnc

Can't use class variable with private nested class

2007-03-27 Thread tron . thomas
The following code will print a message only once: class PrintOnce: printOnce = True def __init__(self): if PrintOnce.printOnce: print 'Printing once.' PrintOnce.printOnce = False first = PrintOnce() second = PrintOnc