why does this fail on python 2.2?
Larry Bates
lbates at swamisoft.com
Mon Aug 30 11:13:44 EDT 2004
Because __slots__ and __new__ were added in 2.3.
Larry Bates
Syscon, Inc.
"John Hunter" <jdhunter at ace.bsd.uchicago.edu> wrote in message
news:mailman.2611.1093878644.5135.python-list at python.org...
>
> I'm trying to understand why some code from a module I'm using is
> failing on 2.3 (sic) but working on 2.3. Here is the minimal example that
> replicates the problem
>
> class Results(object):
> __slots__ = ( "__doinit" )
> def __new__(cls):
> retobj = object.__new__(cls)
> retobj.__doinit = True
> return retobj
>
> x = Results()
>
> On python2.2, this fails with
>
> mother:~/tmp> python2.2 test.py
> Traceback (most recent call last):
> File "test.py", line 8, in ?
> x = Results()
> File "test.py", line 5, in __new__
> retobj.__doinit = True
> AttributeError: 'Results' object has no attribute '_Results__doinit'
More information about the Python-list
mailing list