[issue44993] enum.auto() starts with one instead of zero

2021-08-26 Thread Eric V. Smith
Change by Eric V. Smith : -- status: open -> closed ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://m

[issue44993] enum.auto() starts with one instead of zero

2021-08-25 Thread Ethan Furman
Ethan Furman added the comment: David, I added a PR for the Enum handling/creation in the ics library. Syncing values with external libraries is definitely *not* what `auto` is intended for. As for why enum members evaluate as True: most objects in Python evaluate to True, unless they have

[issue44993] enum.auto() starts with one instead of zero

2021-08-25 Thread Vedran Čačić
Vedran Čačić added the comment: And CEnum is probably the best name for it. "Int" part is pretty much implied in "C" part. -- ___ Python tracker ___ __

[issue44993] enum.auto() starts with one instead of zero

2021-08-25 Thread Ethan Furman
Ethan Furman added the comment: Putting an enum in the ctypes module is a decent idea. -- ___ Python tracker ___ ___ Python-bugs-li

[issue44993] enum.auto() starts with one instead of zero

2021-08-25 Thread David Rebbe
David Rebbe added the comment: Thank you for referencing the PEP, I just managed to read through it and I still don't have a very good understanding why it needs to default to 1. PEP 435 states: "The reason for defaulting to 1 as the starting number and not 0 is that 0 is False in a boolean

[issue44993] enum.auto() starts with one instead of zero

2021-08-24 Thread Ethan Furman
Ethan Furman added the comment: David, what is the actual use-case that tripped you up? There are a few ways to create Enums from other systems (json files, cpp files, etc.). -- ___ Python tracker

[issue44993] enum.auto() starts with one instead of zero

2021-08-24 Thread Ethan Furman
Ethan Furman added the comment: My apologies for my apologies -- for some reason I thought this was first posted in August of 2020. -- ___ Python tracker ___

[issue44993] enum.auto() starts with one instead of zero

2021-08-24 Thread Ethan Furman
Ethan Furman added the comment: Firstly (or Zeroithly ;) my apologies for not noticing this earlier. In the functional API section: -- The reason for defaulting to 1 as the starting number and not 0 is that 0 is False in a boolean sense, but enum members all evalu

[issue44993] enum.auto() starts with one instead of zero

2021-08-24 Thread Eric V. Smith
Eric V. Smith added the comment: I think everyone understands, we just feel that it doesn't matter. You can see if PEP 435 answers your question. Changing to an enhancement request for 3.11, for the proposal to add a optional argument to auto(). -- nosy: +ethan.furman type: -> enha

[issue44993] enum.auto() starts with one instead of zero

2021-08-24 Thread David Rebbe
David Rebbe added the comment: Seems like there is a misunderstanding here as to why this is an issue. I can write an example up that would expand on the file I attached, but I feel like anyone that has experience in the above situations would identify this as an issue. Can I ask why Pytho

[issue44993] enum.auto() starts with one instead of zero

2021-08-24 Thread Eric V. Smith
Eric V. Smith added the comment: Other than it’s not what you expect, do you have a concrete example of what problem this is causing you? We’re unlikely to change anything without knowing what problem is being solved. -- nosy: +eric.smith ___ Pytho

[issue44993] enum.auto() starts with one instead of zero

2021-08-24 Thread David Rebbe
David Rebbe added the comment: Definition of equivalent 1: equal in force, amount, or value Are you referring to memory space as what is actually stored in RAM? If so, that seems to be outside the scope here. I don't think anyone expected an interpreted language to have the same memory space

[issue44993] enum.auto() starts with one instead of zero

2021-08-24 Thread Vedran Čačić
Vedran Čačić added the comment: _But why should it matter that starting value is the same_ unless you actually use IntEnums for indexing? About your code: what do you _actually_ mean by "equivalent"? I hope you don't think that the memory representation is the same. You keep mentioning APIs a

[issue44993] enum.auto() starts with one instead of zero

2021-08-24 Thread David Rebbe
David Rebbe added the comment: Welcome to enums, they don't matter until they do. I'm personally not a fan of enums for APIs but they exist all the time. Indexing was an example case that nothing starts at 1. See the attached file to demonstrate differences. -- Added file: https://b

[issue44993] enum.auto() starts with one instead of zero

2021-08-24 Thread Vedran Čačić
Vedran Čačić added the comment: Honestly, I think it's backwards. Either they _do_ matter because of some external factor (you mention network interoperability, though I'd like you to clarify... what exactly did you send over the network?), or they don't matter (if done right, you shouldn't e

[issue44993] enum.auto() starts with one instead of zero

2021-08-24 Thread David Rebbe
David Rebbe added the comment: I only created this issue because its a deviation from any standard that exists AFAIK. Nothing I know of starts at 1 in programming and I more than likely won't be the last one to make this mistake. If indexing in Python started at 1 or any other accessor for t

[issue44993] enum.auto() starts with one instead of zero

2021-08-24 Thread Vedran Čačić
Vedran Čačić added the comment: I think you should be even more explicit. If values matter, they _should_ be seen in code. (All of them, not just the first one.) auto() just means "this value doesn't really matter". And it's not really hard to write concrete values instead of auto(), in many

[issue44993] enum.auto() starts with one instead of zero

2021-08-24 Thread David Rebbe
David Rebbe added the comment: Understandable and I do believe IntEnum should default as zero as its the default type most will choose when trying to mimic other languages. C/C++ has the same problem where the value isn't suppose to matter but as soon as you go across the compiled / interpre

[issue44993] enum.auto() starts with one instead of zero

2021-08-24 Thread Vedran Čačić
Vedran Čačić added the comment: For IntEnum, maybe. But for Enum, the whole point of auto() is that the values don't really matter. The rationale was that with IntEnum, truth testing (which is often used in Python to realize Optional) would distinguish None, and then all true Enums would actu

[issue44993] enum.auto() starts with one instead of zero

2021-08-24 Thread David Rebbe
New submission from David Rebbe : enum.auto() By default, the initial value starts at 1. Per the documentation here: https://docs.python.org/3/library/enum.html#enum.auto This doesn't really follow expected behavior in majority of programming languages nor python. Most will expect starting va