[Python-ideas] Enum and the Standard Library (and __str__ and __repr__)

2020-11-03 Thread Ethan Furman
TL;DR Changes may be coming to Enum str() and repr() -- your (informed) opinion requested. :-) Python-Dev thread [0], summary below: As you may have noticed, Enums are starting to pop up all over the stdlib [1]. To facilitate transforming existing module constants to IntEnums there is `Int

[Python-ideas] Re: Enum and the Standard Library (and __str__ and __repr__)

2020-11-03 Thread Chris Angelico
On Wed, Nov 4, 2020 at 6:11 AM Ethan Furman wrote: > > TL;DR Changes may be coming to Enum str() and repr() -- your (informed) > opinion requested. :-) > > After discussions with Guido I made a (largely done) PR [3] which: > > for stdlib global constants (such as RE) > - repr() -> uses `mod

[Python-ideas] Re: Enum and the Standard Library (and __str__ and __repr__)

2020-11-03 Thread Ethan Furman
On 11/3/20 11:26 AM, Chris Angelico wrote: On Wed, Nov 4, 2020 at 6:11 AM Ethan Furman wrote: TL;DR Changes may be coming to Enum str() and repr() -- your (informed) opinion requested. :-) Does this affect my own enums too, or just stdlib ones? I'm not entirely sure on that point. That

[Python-ideas] Re: Enum and the Standard Library (and __str__ and __repr__)

2020-11-03 Thread Steven D'Aprano
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

[Python-ideas] A python_include() for cgi programming

2020-11-03 Thread warp_drive enterprise
I have recently have the opportunity to work on a Python web application. I've found it beneficial to reduce duplicate code with the following code lines import textwrap from pathlib import Path exec(textwrap.dedent(Path('myfile.py').read_text())) Perhaps such code could be the basis for a pyt

[Python-ideas] Re: Enum and the Standard Library (and __str__ and __repr__)

2020-11-03 Thread Ethan Furman
On 11/3/20 3:58 PM, Steven D'Aprano wrote: 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` Wha

[Python-ideas] Re: A python_include() for cgi programming

2020-11-03 Thread Cade Brown
``` import myfile ``` or ``` from myfile import * ``` Will import the names from another file. You should use this instead of executing text read from a path. Thanks, *Cade Brown* Research Assistant @ ICL (Innovative Computing Laboratory) Personal Email: [email protected] ICL/College Em