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.
--
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.
--
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
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
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
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
Changes by Eric Snow ericsnowcurren...@gmail.com:
--
nosy: +eric.snow
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue1475692
___
___
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) \
Changes by Mark Lawrence breamore...@yahoo.co.uk:
--
versions: -Python 2.6
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue1475692
___
___
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
___
Changes by Matthieu Labbé bugs.python@mattlabbe.com:
--
type: feature request - behavior
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue1475692
___
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
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
13 matches
Mail list logo