[Python-Dev] Re: Enum and the Standard Library

2020-09-19 Thread Guido van Rossum
That would be more palatable if it wasn't so common to use manually assigned numerical values (as most of the examples in the enum module docs do) or the default auto(). I'm just trying to present an argument that if the str() of an enum was its name and the repr() was its "full name" (at least

[Python-Dev] Re: Enum and the Standard Library

2020-09-19 Thread Chris Angelico
On Sat, Sep 19, 2020 at 11:44 AM Guido van Rossum wrote: > Another brainstorm (or brainfart): maybe repr() should show the module/class > and the name, and str() should only show the name. We'd then get > ``` > >>> # Mock-up! > >>> print(str(re.i)) > IGNORE > >>> print(repr(re.i)) > re.IGNORE >

[Python-Dev] Re: Enum and the Standard Library

2020-09-19 Thread Ethan Furman
On 9/19/20 11:32 AM, Guido van Rossum wrote: > On Sat, Sep 19, 2020 at 1:29 AM Ethan Furman wrote: >> On 9/18/20 6:41 PM, Guido van Rossum wrote: >>> Another brainstorm (or brainfart): maybe repr() should show the >>> module/class and the name, and str() should only show the name. We'd >>> then

[Python-Dev] Re: Enum and the Standard Library

2020-09-19 Thread Guido van Rossum
On Sat, Sep 19, 2020 at 1:29 AM Ethan Furman wrote: > On 9/18/20 6:41 PM, Guido van Rossum wrote: > [...] > > Another brainstorm (or brainfart): maybe repr() should show the > > module/class and the name, and str() should only show the name. We'd > > then get > > ``` > > >>> # Mock-up! >

[Python-Dev] Re: Enum and the Standard Library

2020-09-19 Thread Antoine Pitrou
On Fri, 18 Sep 2020 18:14:35 -0700 Ethan Furman wrote: > > So at this point, I think the choices are: > > Standard Enum >__repr__ __str__ >RegexFlag.IGNORECASE > > and > > Modified Converted Constant >__repr__ __str__ > re.IGNORECASE

[Python-Dev] Re: Hygenic macros PEP.

2020-09-19 Thread Random832
On Tue, Sep 15, 2020, at 15:22, Mark Shannon wrote: > > Hi all, > > I'd like to propose a new PEP for hygienic macros. To be clear, "hygienic macros" doesn't *just* mean AST-rewriting macros, it also means being able to define variables within the macro expansion that can't possibly collide

[Python-Dev] The Python documentation is now compatible with Sphinx 3.2 and newer

2020-09-19 Thread Stephen J. Turnbull
Victor Stinner writes: > I discussed with the Sphinx maintainers. They accepted to add two new > options to Sphinx 3.2 to add an opt-in Sphinx 2 compatibility mode: Wow, this is really going the extra mile! Great work, Victor! ___ Python-Dev mailing

[Python-Dev] Re: Enum and the Standard Library

2020-09-19 Thread Stephen J. Turnbull
Ethan Furman writes: > I counted roughly 25 Enums in the stdlib at this point, and only two of > them have modified reprs or strs; and one of those is an internal class. > It's worth noting that two others are buggy -- one is being fancy with > values and didn't get the custom __new__

[Python-Dev] Re: Enum and the Standard Library

2020-09-19 Thread Ethan Furman
On 9/18/20 6:41 PM, Guido van Rossum wrote: > On Fri, Sep 18, 2020 at 6:19 PM Ethan Furman wrote: >> So at this point, I think the choices are: >> >> Standard Enum >> __repr__ __str__ >>RegexFlag.IGNORECASE >> >> and >> >> Modified Converted Constant >>