[issue18042] Provide enum.unique class decorator

2013-07-18 Thread Roundup Robot
Roundup Robot added the comment: New changeset 2079a517193b by Ethan Furman in branch 'default': closes issue18042 -- a `unique` decorator is added to enum.py http://hg.python.org/cpython/rev/2079a517193b -- nosy: +python-dev resolution: - fixed stage: patch review - committed/rejected

[issue18042] Provide enum.unique class decorator

2013-07-01 Thread STINNER Victor
STINNER Victor added the comment: The documentation still contains an Interesting example: UniqueEnum. I would prefer to only have one obvious way to get unique enum, so please just drop this example. Or at least, mention the new decorator in the example. -- nosy: +haypo

[issue18042] Provide enum.unique class decorator

2013-06-29 Thread Ethan Furman
Ethan Furman added the comment: Integrated comments. -- Added file: http://bugs.python.org/file30730/unique.stoneleaf.02.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18042 ___

[issue18042] Provide enum.unique class decorator

2013-06-28 Thread Ethan Furman
Ethan Furman added the comment: unique() added to enum.py; tests added; docs updated. If no complaints within a few days I'll push them through. -- keywords: +patch Added file: http://bugs.python.org/file30722/unique.stoneleaf.01.patch ___ Python

[issue18042] Provide enum.unique class decorator

2013-06-28 Thread Ethan Furman
Changes by Ethan Furman et...@stoneleaf.us: -- stage: - patch review ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18042 ___ ___ Python-bugs-list

[issue18042] Provide enum.unique class decorator

2013-06-28 Thread Eli Bendersky
Eli Bendersky added the comment: Sent some review comments. I'll be on a short vacation this weekend, so please wait at least until next week so I can review the changes. Also, Nick should definitely review this too :) -- ___ Python tracker

[issue18042] Provide enum.unique class decorator

2013-06-19 Thread Ethan Furman
Ethan Furman added the comment: I haven't seen any discouraging words regarding the decorator. If no one has any compelling reasons why it shouldn't be added, I'll craft a version and put it in (only real difference with Nick's would be catching all the duplicates at once instead of one at a

[issue18042] Provide enum.unique class decorator

2013-06-08 Thread Barry A. Warsaw
Barry A. Warsaw added the comment: +1 for the decorator! -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18042 ___ ___ Python-bugs-list mailing

[issue18042] Provide enum.unique class decorator

2013-06-08 Thread Barry A. Warsaw
Changes by Barry A. Warsaw ba...@python.org: -- nosy: +barry ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18042 ___ ___ Python-bugs-list mailing

[issue18042] Provide enum.unique class decorator

2013-05-26 Thread Ezio Melotti
Changes by Ezio Melotti ezio.melo...@gmail.com: -- nosy: +ezio.melotti ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18042 ___ ___

[issue18042] Provide enum.unique class decorator

2013-05-25 Thread Phil Connell
Changes by Phil Connell pconn...@gmail.com: -- nosy: +pconnell ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18042 ___ ___ Python-bugs-list

[issue18042] Provide enum.unique class decorator

2013-05-23 Thread Nick Coghlan
New submission from Nick Coghlan: Another attempt at tackling the but I want to ensure my enum values are unique problem that PEP 435 deliberately chose not to handle. My previous suggestion (in issue 17959) was rightly rejected due to the other problems it caused, but this idea is much

[issue18042] Provide enum.unique class decorator

2013-05-23 Thread Nick Coghlan
Changes by Nick Coghlan ncogh...@gmail.com: -- dependencies: +Code, test, and doc review for PEP-0435 Enum nosy: +eli.bendersky, ethan.furman ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18042

[issue18042] Provide enum.unique class decorator

2013-05-23 Thread Ethan Furman
Ethan Furman added the comment: This is certainly an effective method, but it places safety off by default. I would rather have a system that was from duplicates by default but had an easy override. The method I had in place in my original code was something like: class Color(Enum,

[issue18042] Provide enum.unique class decorator

2013-05-23 Thread Nick Coghlan
Nick Coghlan added the comment: I take Guido's acceptance of the PEP (and the discussion in the previous issue) as meaning the default behaviour (allowing aliases) is no longer up for debate. Hence this suggestion to offer a self-documenting way to opt in to the more restrictive variant.

[issue18042] Provide enum.unique class decorator

2013-05-23 Thread Ethan Furman
Ethan Furman added the comment: I'm not giving up hope yet. Plenty of Python features no longer work the way they did when their PEP was accepted. ;) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18042

[issue18042] Provide enum.unique class decorator

2013-05-23 Thread Nick Coghlan
Nick Coghlan added the comment: You don't generally see reversals of decisions where Guido has made an explicit choice based on consistency with the rest of the language. The fact that aliases are permitted in enumerations by default is consistent with the normal behaviour of namespaces and

[issue18042] Provide enum.unique class decorator

2013-05-23 Thread Ethan Furman
Ethan Furman added the comment: Oh. Well, I like your decorator. :) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18042 ___ ___

[issue18042] Provide enum.unique class decorator

2013-05-23 Thread Nick Coghlan
Nick Coghlan added the comment: Don't worry, compared to some of the ideas I've had (and rightfully had shot down) over the years, that one was positively sensible :) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18042