Alaric Haag wrote:
Hello,
Is the use of __repr__ below a "really bad idea"?
class Dimension():
def __init__(self, setp, name):
ptr = setp.contents.dim
while ptr.contents.name != name:
ptr = ptr.contents.next
self.name = ptr.contents.name
self.size = ptr.contents.size
self.unlimited = bool(ptr.contents.unlimited)
self.coord = ptr.contents.coord
def __repr__(self):
return '%g' % (self.size)
As written, if a program references a Dimension instance without an
attribute, it gets the size attrbute "by default".
No it does not. It gets a string representation of the size. Not the
same thing.
--
http://mail.python.org/mailman/listinfo/python-list