Mailing List Archive

[issue43945] [Enum] standardize format() behavior
Ethan Furman <ethan@stoneleaf.us> added the comment:

Thinking about this some more I am partially reversing course. The idea behind `IntEnum` and `IntFlag` is to be, as close as possible, drop-in replacements for existing integer-based constants. If the format() of those two change then they become much less attractive.

So it won't. Instead, any user-mixed enumerations will get the new behavior:

class Grades(int, Enum):
A = 5
F = 0

will emit a DeprecationWarning now, and in 3.12 `format(Grades.A)` will product 'A' instead of '5'.

----------

_______________________________________
Python tracker <report@bugs.python.org>
<https://bugs.python.org/issue43945>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com
[issue43945] [Enum] standardize format() behavior [ In reply to ]
Change by Ethan Furman <ethan@stoneleaf.us>:


----------
pull_requests: +25337
pull_request: https://github.com/python/cpython/pull/26752

_______________________________________
Python tracker <report@bugs.python.org>
<https://bugs.python.org/issue43945>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com
[issue43945] [Enum] standardize format() behavior [ In reply to ]
Ethan Furman <ethan@stoneleaf.us> added the comment:


New changeset f60b07ab6c943fce084772c3c7731ab3bbd213ff by Ethan Furman in branch 'main':
bpo-43945: [Enum] reduce scope of new format() behavior (GH-26752)
https://github.com/python/cpython/commit/f60b07ab6c943fce084772c3c7731ab3bbd213ff


----------

_______________________________________
Python tracker <report@bugs.python.org>
<https://bugs.python.org/issue43945>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com
[issue43945] [Enum] standardize format() behavior [ In reply to ]
Change by Ethan Furman <ethan@stoneleaf.us>:


----------
pull_requests: +25375
pull_request: https://github.com/python/cpython/pull/26791

_______________________________________
Python tracker <report@bugs.python.org>
<https://bugs.python.org/issue43945>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com
[issue43945] [Enum] standardize format() behavior [ In reply to ]
Ethan Furman <ethan@stoneleaf.us> added the comment:


New changeset 1b4addf3cbd0ef424939681ee67c802328d567ba by Ethan Furman in branch '3.10':
[3.10] bpo-43945: [Enum] reduce scope of new format() behavior (GH-26752)
https://github.com/python/cpython/commit/1b4addf3cbd0ef424939681ee67c802328d567ba


----------

_______________________________________
Python tracker <report@bugs.python.org>
<https://bugs.python.org/issue43945>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com
[issue43945] [Enum] standardize format() behavior [ In reply to ]
Change by Ethan Furman <ethan@stoneleaf.us>:


----------
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed

_______________________________________
Python tracker <report@bugs.python.org>
<https://bugs.python.org/issue43945>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com
[issue43945] [Enum] standardize format() behavior [ In reply to ]
Change by Barry A. Warsaw <barry@python.org>:


----------
nosy: +barry

_______________________________________
Python tracker <report@bugs.python.org>
<https://bugs.python.org/issue43945>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com