On Tue, Nov 03, 2020 at 11:10:37AM -0800, Ethan Furman wrote:

> After discussions with Guido I made a (largely done) PR [3] which:
> 
> for stdlib global constants (such as RE)
>    - repr() -> uses `module.member_name`
>    - str() -> uses `member_name`

What's `RE`? Do you mean the enums in the re module, `re.I` etc?

 
> for stdlib non-global constants, and enums in general
>    - repr() -> uses `class.member_name`
>    - str() -> uses `member_name`

How does that work? If I do this:

    class MyEnum(Enum):
        RED = 'red'

    RED = MyEnum.RED

is that a global constant or a non-global constant? How do I hook into 
whatever magic is used to decide one way or the other?



> The questions I would most appreciate an answer to at this point:
> 
> - do you think the change has merit?
> - why /shouldn't/ we make the change?

It's not clear to me what the change actually is. You explained what the 
behaviour is being changed to but not what it is being changed from.

My quick tests are inconclusive:

re.I has repr and str both return 're.IGNORECASE'. Will that change?

MyEnum.RED above has repr "<MyEnum.RED: 'red'>" and str 'MyEnum.RED'. 
Presumably that will change to 'MyEnum.RED' and 'RED' respectively.


-- 
Steve
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/4YFHKRDDCXH2B4NF6U73ZJQG3PDCAY7Y/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to