[issue46108] Enum repr() incorrect when mixed with non-__new__ data types

2022-01-17 Thread Ethan Furman


Ethan Furman  added the comment:

Fixed in 3.11.

--
resolution:  -> fixed
stage:  -> resolved
status: open -> closed
superseder:  -> Enum: modify __repr__, __str__; update docs
type:  -> behavior

___
Python tracker 

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



[issue46108] Enum repr() incorrect when mixed with non-__new__ data types

2021-12-17 Thread Ethan Furman


Ethan Furman  added the comment:

Thanks, test added.  I also updated the title.

Code updated to treat any __repr__s as affecting the display of the member 
value instead of the member itself (i.e. the "<...: %r>" portion).  if a user 
actually wants to change the member repr they can assign it when creating the 
Enum:

class Entries(Foo, Enum):
ENTRY = 1
__repr__ = Foo.__repr__

assert repr(Entries.ENTRY1) == 'Entries(a=1)'

--
title: Enum repr() incorrect when mixed with dataclasses -> Enum repr() 
incorrect when mixed with non-__new__ data types

___
Python tracker 

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