Message328773
Related: https://bugs.python.org/issue5322
Consider the following program:
class Color(object):
__slots__ = (('name',))
def __init__(self, name):
self.name = name
green = Color('green') # Works
assert green.name == 'green'
Color.__new__ = 0
del Color.__new__
red = Color('red') # Fails in Python 3; works in Python 2 & pypy
assert red.name == 'red'
This works in Python 2, pypy, but fails in Python 3 as follows:
Traceback (most recent call last):
File "x.py", line 13, in <module>
red = Color('red') # Fails in Python 3; works in Python 2 & pypy
TypeError: object() takes no parameters |
|
Date |
User |
Action |
Args |
2018-10-29 00:16:25 | joydiamond | set | recipients:
+ joydiamond |
2018-10-29 00:16:25 | joydiamond | set | messageid: <1540772185.07.0.788709270274.issue35098@psf.upfronthosting.co.za> |
2018-10-29 00:16:25 | joydiamond | link | issue35098 messages |
2018-10-29 00:16:24 | joydiamond | create | |
|