Mystery Theater New Style Classes
Bob Gailer
bgailer at alum.rpi.edu
Thu Jul 24 12:18:54 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
The question this leads to is: how does one access the value of such a
class within a class method?
Bob Gailer
bgailer at alum.rpi.edu
303 442 2625
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20030724/49a3d384/attachment.html>
-------------- 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