[issue26748] enum.Enum is False-y

2016-04-14 Thread Ethan Furman
Ethan Furman added the comment: Enum classes are now Truth-y in 3.4, 3.5, enum34, and aenum. :) -- assignee: -> ethan.furman resolution: -> fixed stage: -> resolved status: open -> closed versions: -Python 2.7 ___ Python tracker

[issue26748] enum.Enum is False-y

2016-04-14 Thread Roundup Robot
Roundup Robot added the comment: New changeset 772805538caf by Ethan Furman in branch '3.4': Issue26748: Enum classes should evaluate as True https://hg.python.org/cpython/rev/772805538caf New changeset f840608f79da by Ethan Furman in branch '3.5': Issue26748: Enum classes should evaluate as Tru

[issue26748] enum.Enum is False-y

2016-04-13 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: See also issue23008. -- nosy: +serhiy.storchaka ___ Python tracker ___ ___ Python-bugs-list mailin

[issue26748] enum.Enum is False-y

2016-04-13 Thread Ethan Furman
Ethan Furman added the comment: EnumMeta /is/ a collection (at least in the same sense the dict class is a collection). ;) Fix is on it's way... -- ___ Python tracker ___

[issue26748] enum.Enum is False-y

2016-04-13 Thread Antoine Pitrou
Antoine Pitrou added the comment: Just reading the code now, the reason is that EnumMeta pretends to be a collection (it defines a __len__ and an __iter__). -- ___ Python tracker __

[issue26748] enum.Enum is False-y

2016-04-13 Thread Antoine Pitrou
Antoine Pitrou added the comment: Yes, I didn't find a separate bug tracker for the enum34 backport, which is why I included that version here. > for IntEnum the behavior is correct Do you remember the argument? I agree that IntEnum *instances* may be falsy, but IntEnum classes I don't see wh

[issue26748] enum.Enum is False-y

2016-04-13 Thread Antoine Pitrou
Antoine Pitrou added the comment: Ok, we posted at the same time :-) Yes, the class is false-y. -- ___ Python tracker ___ ___ Python-b

[issue26748] enum.Enum is False-y

2016-04-13 Thread Guido van Rossum
Guido van Rossum added the comment: Oh wait. The *class* is False-y? That's definitely a bug, just fix it. -- ___ Python tracker ___ _

[issue26748] enum.Enum is False-y

2016-04-13 Thread Guido van Rossum
Guido van Rossum added the comment: I guess it's marked 2.7 because of the enum34 backport? There's no enum in the 2.7 stdlib. I believe this was brought up before on one of the lists but I don't recall the outcome of the discussion, except that for IntEnum the behavior is correct. I tend to

[issue26748] enum.Enum is False-y

2016-04-13 Thread Antoine Pitrou
New submission from Antoine Pitrou: >>> import enum >>> bool(enum.Enum) False >>> bool(enum.IntEnum) False This behaviour is relatively unexpected for classes, and can lead to subtle bugs such as the following: https://bitbucket.org/ambv/singledispatch/issues/8/inconsistent-hierarchy-with-enum