[IronPython] __slots__ and __str__/__repr__

Simon Dahlbacka simon.dahlbacka at gmail.com
Wed Jul 5 12:29:04 PDT 2006


CPython2.4.1
>>>class foo(object):
...    __slots__ = ["bar"]
...
>>>foo.bar
<member 'foo' of 'foo' objects>
>>> f = foo()
>>> f.bar
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
AttributeError: bar




Ironpython beta8
>>>class foo(object):
...    __slots__ = ["bar"]
>>>foo.bar
<property# foo on Object_1>
>>> f = foo()
>>> f.bar
Traceback (most recent call last):
  File , line 0, in <stdin>##42
  File , line 0, in get_bar##43
AttributeError: '<class '__main__.foo'>' object has no attribute 'bar'
-------------- next part --------------
An HTML attachment was scrubbed...
URL: /pipermail/users-ironpython.com/attachments/20060705/298ff048/attachment.html


More information about the users mailing list