[issue25147] Enum: remove dependency on OrderedDict

2015-09-18 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: But the comment is false. That change doesn't reduce startup cost. -- ___ Python tracker ___

[issue25147] Enum: remove dependency on OrderedDict

2015-09-18 Thread Stefan Behnel
Stefan Behnel added the comment: Let's say the change minimises the dependencies. That is a reasonable goal, too. -- ___ Python tracker ___

[issue25147] Enum: remove dependency on OrderedDict

2015-09-17 Thread Ethan Furman
Changes by Ethan Furman : -- keywords: +patch Added file: http://bugs.python.org/file40489/issue25147.stoneleaf.01.patch ___ Python tracker

[issue25147] Enum: remove dependency on OrderedDict

2015-09-17 Thread Ethan Furman
New submission from Ethan Furman: Pulling in collections.OrderedDict has a significant startup cost (from what I've heard, and can easily believe by glancing at all the imports in collections.__init__). By keeping a separate list for the Enum member names using Enum in the stdlib becomes

[issue25147] Enum: remove dependency on OrderedDict

2015-09-17 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: This change has visible side effect: __members__ is no longer ordered. This should be reflected in the documentation and in What's New. -- nosy: +serhiy.storchaka ___ Python tracker

[issue25147] Enum: remove dependency on OrderedDict

2015-09-17 Thread STINNER Victor
STINNER Victor added the comment: > This change has visible side effect: __members__ is no longer ordered. This property of part of the PEP 435 (enum): "The special attribute __members__ is an ordered dictionary mapping names to members." IMHO if we really want to change this, it must be

[issue25147] Enum: remove dependency on OrderedDict

2015-09-17 Thread Ethan Furman
Ethan Furman added the comment: Is pulling in `_collections` not as resource intensive as pulling in `collections`? -- ___ Python tracker ___

[issue25147] Enum: remove dependency on OrderedDict

2015-09-17 Thread Eric Snow
Eric Snow added the comment: OrderedDict has a C implementation now. So try the following: try: from _collections import OrderedDict except ImportError: from collections import OrderedDict -- nosy: +eric.snow ___ Python tracker

[issue25147] Enum: remove dependency on OrderedDict

2015-09-17 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: _collections exists because it contains C implementations of some collections classes or helpers. _collections itself is imported only in collections and threading. And in threading the same idiom as proposed by Eric is used: try: from _collections

[issue25147] Enum: remove dependency on OrderedDict

2015-09-17 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: I tried to measure import time with different patches and didn't notice any difference. -- ___ Python tracker ___

[issue25147] Enum: remove dependency on OrderedDict

2015-09-17 Thread Ethan Furman
Ethan Furman added the comment: In that case I'll go with _collections; if performance does become an issue with other pythons later we can add the caching property. Thanks for all the insights. -- ___ Python tracker

[issue25147] Enum: remove dependency on OrderedDict

2015-09-17 Thread R. David Murray
R. David Murray added the comment: _collections exists because it contains only the stuff that is needed at python startup. So it is loaded regardless, and thus is very cheap to import elsewhere :) -- nosy: +r.david.murray ___ Python tracker

[issue25147] Enum: remove dependency on OrderedDict

2015-09-17 Thread Ethan Furman
Ethan Furman added the comment: _collections sounds cool, but the flip side is any python without the C implemntation would still have the slower startup, right? No, I don't have measurements -- just that I have heard importing collections can have an effect on startup time. Of course, it's

[issue25147] Enum: remove dependency on OrderedDict

2015-09-17 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: If there is no any evidences, we shouldn't change a code. -- ___ Python tracker ___

[issue25147] Enum: remove dependency on OrderedDict

2015-09-17 Thread Ethan Furman
Ethan Furman added the comment: Serhiy, your objection is noted, thank you. -- ___ Python tracker ___ ___

[issue25147] Enum: remove dependency on OrderedDict

2015-09-17 Thread Roundup Robot
Roundup Robot added the comment: New changeset b77916d2d7cc by Ethan Furman in branch 'default': Close issue25147: use C implementation of OrderedDict https://hg.python.org/cpython/rev/b77916d2d7cc -- nosy: +python-dev resolution: -> fixed stage: patch review -> resolved status: open

[issue25147] Enum: remove dependency on OrderedDict

2015-09-17 Thread Zachary Ware
Zachary Ware added the comment: That change could use a comment stating why it's doing things that way instead of the 'obvious' way. -- nosy: +zach.ware ___ Python tracker

[issue25147] Enum: remove dependency on OrderedDict

2015-09-17 Thread Roundup Robot
Roundup Robot added the comment: New changeset c0363f849624 by Ethan Furman in branch 'default': Issue 25147: add reason for using _collections https://hg.python.org/cpython/rev/c0363f849624 -- ___ Python tracker

[issue25147] Enum: remove dependency on OrderedDict

2015-09-17 Thread Stefan Behnel
Stefan Behnel added the comment: > _collections sounds cool, but the flip side is any python without the C > implemntation would still have the slower startup, right? I wouldn't bother too much with that, certainly not given the order we are talking about here. Jython's startup time is slowed