Mystery Theater New Style Classes

Bob Gailer bgailer at alum.rpi.edu
Thu Jul 24 12:05:30 EDT 2003


Predict the output:

class A(int):
     classval = 99
     def __init__(self, val = 0):
         if val:
             self = val
         else:
             self = A.classval
a=A(3)
b=A()
print a,b

Bob Gailer
bgailer at alum.rpi.edu
303 442 2625
-------------- next part --------------

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.500 / Virus Database: 298 - Release Date: 7/10/2003


More information about the Python-list mailing list