[issue42385] Should enum.auto's behavior be adjusted for StrEnum to return the enum name?

2020-12-09 Thread Ethan Furman


Change by Ethan Furman :


--
keywords: +patch
pull_requests: +22587
stage: needs patch -> patch review
pull_request: https://github.com/python/cpython/pull/23727

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42385] Should enum.auto's behavior be adjusted for StrEnum to return the enum name?

2020-11-17 Thread Ethan Furman


Ethan Furman  added the comment:

A good idea.

Since the Python opinion of enum members is that they be upper-cased, and every 
magic string constant I have seen is lower-case, 
`StrEnum._generate_next_value_` should lower case the name.  Users can 
substitute their own `_gnv_` for different behavior.

--
assignee:  -> ethan.furman
stage:  -> needs patch
type:  -> behavior

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42385] Should enum.auto's behavior be adjusted for StrEnum to return the enum name?

2020-11-17 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +barry, eli.bendersky, ethan.furman

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42385] Should enum.auto's behavior be adjusted for StrEnum to return the enum name?

2020-11-17 Thread Antony Lee


New submission from Antony Lee :

Currently, enum.auto doesn't work with the new (Py3.10) StrEnum: `class 
E(enum.StrEnum): a = enum.auto()` results in `TypeError: 1 is not a string`.

I would guess that the most reasonable behavior for auto() in a StrEnum would 
be to return the name itself, as implemented in the AutoName example at 
https://docs.python.org/3.10/library/enum.html#using-automatic-values.  I 
believe that this may just be a matter of copying the corresponding 
`_generate_next_value_` implementation into the definition of StrEnum?

--
components: Library (Lib)
messages: 381220
nosy: Antony.Lee
priority: normal
severity: normal
status: open
title: Should enum.auto's behavior be adjusted for StrEnum to return the enum 
name?
versions: Python 3.10

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com