[issue1475692] replacing obj.__dict__ with a subclass of dict

2020-11-07 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: There is no longer need to use OrderedDict as __dict__, but ctypes types have tp_dict which are instances of dict subclass (StgDict). Disabling setting it to anything that is not an exact dict would break ctypes. --

[issue1475692] replacing obj.__dict__ with a subclass of dict

2020-11-07 Thread Raymond Hettinger
Raymond Hettinger added the comment: I'm going to mark this as rejected. After 14 years, no clean and performant solution has emerged, yet the world of Python seems to be fine with the status quo. This issue doesn't seem to be getting in the way of people doing their job. --

[issue1475692] replacing obj.__dict__ with a subclass of dict

2020-11-06 Thread Irit Katriel
Irit Katriel added the comment: Calling the overridden __getitem__ is rejected due to performance. Forbidding dict subclasses is rejected because subclasses like ordereddict and defaultdict can be useful. I think the only remaining possibilities are to do nothing or to raise an error when

[issue1475692] replacing obj.__dict__ with a subclass of dict

2016-01-30 Thread Josh Rosenberg
Josh Rosenberg added the comment: Just FYI, if you're only trying to make immutable objects, that's what subclassing tuple with properties and __slots__ = () is for (collections.namedtuple does exactly this, building the Python declaration as a string and then eval-ing it to produce a tuple

[issue1475692] replacing obj.__dict__ with a subclass of dict

2016-01-29 Thread Torsten Landschoff
Torsten Landschoff added the comment: I just bumped into this issue because I was shown by a colleague that my implementation of immutable objects (by replacing __dict__ with an ImmutableDict that inherits from dict and blocks write accesses) is ineffective - ouch! I'd expect that Python

[issue1475692] replacing obj.__dict__ with a subclass of dict

2016-01-29 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Python uses concrete class API (PyDict_GetItem and like) for resolving attributes. Using general mapping API would slow down attribute lookup in common case. This is performance critical part of Python and we should be very careful changing it. On the

[issue1475692] replacing obj.__dict__ with a subclass of dict

2014-05-12 Thread Eric Snow
Changes by Eric Snow ericsnowcurren...@gmail.com: -- nosy: +eric.snow ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1475692 ___ ___

[issue1475692] replacing obj.__dict__ with a subclass of dict

2013-04-29 Thread Kushal Das
Kushal Das added the comment: In Objects/typeobject.c we have subtype_setdict function, in which at line 1830 we have PyDict_Check() macro call, which checks if it is a subclass of dict or not. The definition is in Include/dictobject.h #define PyDict_Check(op) \

[issue1475692] replacing obj.__dict__ with a subclass of dict

2010-08-22 Thread Mark Lawrence
Changes by Mark Lawrence breamore...@yahoo.co.uk: -- versions: -Python 2.6 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1475692 ___ ___

[issue1475692] replacing obj.__dict__ with a subclass of dict

2009-09-08 Thread Matthieu Labbé
Changes by Matthieu Labbé bugs.python@mattlabbe.com: -- nosy: +matthieu.labbe versions: +Python 2.4, Python 2.5 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1475692 ___

[issue1475692] replacing obj.__dict__ with a subclass of dict

2009-09-08 Thread Matthieu Labbé
Changes by Matthieu Labbé bugs.python@mattlabbe.com: -- type: feature request - behavior ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1475692 ___

[issue1475692] replacing obj.__dict__ with a subclass of dict

2009-09-08 Thread R. David Murray
R. David Murray rdmur...@bitdance.com added the comment: 2.5 and 2.4 are in security-fix-only mode, so we don't set them in versions since bugs won't get fixed there. I don't think overridden methods should be called, since that would slow down attribute lookup, which is already a bottleneck in

[issue1475692] replacing obj.__dict__ with a subclass of dict

2009-03-20 Thread Daniel Diniz
Daniel Diniz aja...@gmail.com added the comment: Confirmed, is this a valid issue? -- nosy: +ajaksu2 stage: - test needed type: - feature request versions: +Python 2.7, Python 3.1 -Python 2.4 ___ Python tracker rep...@bugs.python.org