New submission from Serhiy Storchaka <storchaka+cpyt...@gmail.com>:

The tkinter.EventType enum was introduced in issue27294. It implements __str__ 
as returning the name for the sole purpose of using in Event.__repr__(). But 
overriding __str__ in the str subclass may be not good idea, because different 
code will get different string representation, depending on whether it calls 
str() explicitly or implicitly (Python code) or read the content of the str 
object directly using C API (C code).

The following code sets EventType.__str__ = str.__str__, so both method will 
get the same value. Instead Event.__repr__() was changed to use the name of the 
enum member directly.

----------
components: Tkinter
messages: 377306
nosy: ethan.furman, serhiy.storchaka, terry.reedy
priority: normal
severity: normal
status: open
title: Restore default __str__ of tkinter.EventType
type: behavior
versions: Python 3.10, Python 3.8, Python 3.9

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue41831>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to