[issue25315] OrderedDict mangled private attribute is inaccessible

2015-10-07 Thread R. David Murray
R. David Murray added the comment: This is a general policy: we have python modules for as many stdlib modules as we can (which is most of them), and for some stdlib modules we also have C accelerators. I will agree that the fact that the documentation has a link to the source code of the col

[issue25315] OrderedDict mangled private attribute is inaccessible

2015-10-07 Thread Emanuel Barry
Emanuel Barry added the comment: The Python implementation will stay for two main reasons, one to provide a working implementation for all those who wish to use a modified version (you, for example, if you want to use a version that lets you alter order), and two for alternate implementations

[issue25315] OrderedDict mangled private attribute is inaccessible

2015-10-07 Thread Serge Matveenko
Serge Matveenko added the comment: Sorry for reopening. I completely agree with the point that is it not necessary for Python and C implementations to duplicate each other. But then the Python OrderedDict implementation should be dropped from the library source. The code that is there now is n

[issue25315] OrderedDict mangled private attribute is inaccessible

2015-10-05 Thread R. David Murray
R. David Murray added the comment: Yes, that would be correct. OrderedDict is designed to keep things in insertion order, so supporting changing that order is not part of its mission. Sorry about that, you'll have to write your own class. Now, Raymond might find the idea of supporting other

[issue25315] OrderedDict mangled private attribute is inaccessible

2015-10-05 Thread Serge Matveenko
Serge Matveenko added the comment: Ok, then the OrderedDict is useless for any advanced hacking like altering the order in which __setitem__ stores items. It is just useless Python code and so much appliances missed for this class:( Thank you all for these completely helpful answers.

[issue25315] OrderedDict mangled private attribute is inaccessible

2015-10-05 Thread R. David Murray
R. David Murray added the comment: A method that starts with an '_' is not part of the API unless documented to be so (as with namedtuple), and a non-special method that starts with two is purposefully mangled so that you cannot accidentally rely on it. The C implementation is an implementati

[issue25315] OrderedDict mangled private attribute is inaccessible

2015-10-05 Thread Emanuel Barry
Emanuel Barry added the comment: The same is true of the decimal and datetime modules. Names starting with an underscore are an implementation detail, and you shouldn't rely on these in production code. -- nosy: +ebarry ___ Python tracker

[issue25315] OrderedDict mangled private attribute is inaccessible

2015-10-05 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : -- assignee: -> rhettinger nosy: +rhettinger priority: normal -> low ___ Python tracker ___ ___ Python-

[issue25315] OrderedDict mangled private attribute is inaccessible

2015-10-05 Thread Serge Matveenko
Serge Matveenko added the comment: If Python source does conform the one in C, it will be completely fine and understandable to have such a change and to rely on it in using version checks or whatever. -- ___ Python tracker

[issue25315] OrderedDict mangled private attribute is inaccessible

2015-10-05 Thread Serge Matveenko
Serge Matveenko added the comment: Zach, ok I got your point. But there is Python implementation in the library still which does not conform the one done in C. Such a behavior is tremendously confusing. If there is both Python and C implementation in the library they must conform each other.

[issue25315] OrderedDict mangled private attribute is inaccessible

2015-10-04 Thread Zachary Ware
Zachary Ware added the comment: This is a side-effect of 3.5 having a C implementation of OrderedDict, and will not be fixed. In the standard library, even just having a single trailing underscore is a clear indication of "if you use this, expect it to break without warning at any time." Man

[issue25315] OrderedDict mangled private attribute is inaccessible

2015-10-04 Thread Serge Matveenko (lig)
New submission from Serge Matveenko (lig): Consider this code in Python 3.5.0: Python 3.5.0 (default, Sep 26 2015, 14:59:25) [GCC 5.1.1 20150618 (Red Hat 5.1.1-4)] on linux Type "help", "copyright", "credits" or "license" for more information. >>> from collections import OrderedDict >>> class M