[issue24840] implement bool conversion for enums to prevent odd edge case

2016-01-16 Thread Ethan Furman
Ethan Furman added the comment: New changeset e4c22eadc25c: use public 'value' -- ___ Python tracker ___ ___ Python-bugs-list mailing

[issue24840] implement bool conversion for enums to prevent odd edge case

2016-01-15 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: I think it is better to use "value" instead of "_value_" in the documentation. -- ___ Python tracker ___ _

[issue24840] implement bool conversion for enums to prevent odd edge case

2016-01-15 Thread Ethan Furman
Ethan Furman added the comment: New changeset: 52dc28ee3c88 -- resolution: -> rejected status: open -> closed ___ Python tracker ___

[issue24840] implement bool conversion for enums to prevent odd edge case

2016-01-15 Thread Ethan Furman
Ethan Furman added the comment: Mike, my apologies. In the future I'll make sure and read the docs before I go through with changes. In the docs (https://www.python.org/dev/peps/pep-0435/#id35): The reason for defaulting to 1 as the starting number and not 0 is that 0 is False in a bo

[issue24840] implement bool conversion for enums to prevent odd edge case

2015-12-22 Thread Gregory P. Smith
Gregory P. Smith added the comment: lets collect some examples of where it causes problems (someone ran into the problem at work which is why i hunted down this bugs.python.org issue) before deciding. If it stays in, it needs a mention in both Misc/NEWS and What's New as it will require some

[issue24840] implement bool conversion for enums to prevent odd edge case

2015-12-22 Thread Ethan Furman
Ethan Furman added the comment: The enum34 backport has been fixed to not have 3.6 only features (assuming the __bool__ change was the only one). Was that your only objection, or do you not want this change in 3.6 either? -- ___ Python tracker

[issue24840] implement bool conversion for enums to prevent odd edge case

2015-12-22 Thread Gregory P. Smith
Gregory P. Smith added the comment: This change breaks existing code that is relying on the behavior of the enum API as shipped in 3.4 and 3.5. Please do NOT do this. Worse, you've landed this change in a "stable" release of the enum34 "backport" module (1.1.1) despite it never having been re

[issue24840] implement bool conversion for enums to prevent odd edge case

2015-09-17 Thread Roundup Robot
Roundup Robot added the comment: New changeset 87a9dff5106c by Ethan Furman in branch 'default': Close issue24840: Enum._value_ is queried for bool(); original patch by Mike Lundy https://hg.python.org/cpython/rev/87a9dff5106c -- nosy: +python-dev resolution: -> fixed stage: patch revi

[issue24840] implement bool conversion for enums to prevent odd edge case

2015-08-11 Thread Ethan Furman
Ethan Furman added the comment: Thanks for finding that, Mike. I'll review and merge in the next few days. -- assignee: -> ethan.furman stage: -> patch review ___ Python tracker _

[issue24840] implement bool conversion for enums to prevent odd edge case

2015-08-11 Thread R. David Murray
R. David Murray added the comment: I agree that it seems odd that testing a 'value' that is false for its truth value would return True. It is surprising, even if it is an edge case. -- ___ Python tracker ___

[issue24840] implement bool conversion for enums to prevent odd edge case

2015-08-10 Thread Mike Lundy
Mike Lundy added the comment: @serhiy.storchaka: It's somewhat of a special case, to be sure. However, I do think it's justified to put it into the base (rather than a user type) for three reasons: 1) It makes IntEnum and Enum consistent. IntEnum actually already handles this case just fine,

[issue24840] implement bool conversion for enums to prevent odd edge case

2015-08-10 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: This looks to me as very special case. Enum doesn't delegates the __bool__ method as well as it doesn't delegates __float__, __lt__, __len__, etc. It is left to user to add these methods if needed. It is easy to add the __bool__ method to user enum. In your

[issue24840] implement bool conversion for enums to prevent odd edge case

2015-08-10 Thread Mike Lundy
Mike Lundy added the comment: (I should note that I just recently signed the contributor agreement, not that this a particularly complex fix, but it hasn't propagated to my profile yet). -- ___ Python tracker

[issue24840] implement bool conversion for enums to prevent odd edge case

2015-08-10 Thread Mike Lundy
Mike Lundy added the comment: @r.david.murray man you're fast :) Sorry, realized I forgot to actually run the tests for 3.5 and 3.4, I'd only run them for master (I've now run them for 3.5 and 3.4 now, too). -- keywords: +patch Added file: http://bugs.python.org/file40160/issue24840.ma

[issue24840] implement bool conversion for enums to prevent odd edge case

2015-08-10 Thread Yury Selivanov
Changes by Yury Selivanov : -- nosy: +ethan.furman ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail

[issue24840] implement bool conversion for enums to prevent odd edge case

2015-08-10 Thread R. David Murray
R. David Murray added the comment: No patch is attached. -- nosy: +r.david.murray ___ Python tracker ___ ___ Python-bugs-list mailing

[issue24840] implement bool conversion for enums to prevent odd edge case

2015-08-10 Thread Mike Lundy
New submission from Mike Lundy: There's a slightly odd edge case which can be summarized as follows: from enum import Enum class Bool(Enum): Yep = True Nope = False for value in Bool: print('%18r is %r' % (value, bool(value))) output: