[Python-ideas] Re: dataclasses: position-only and keyword-only fields

2021-03-14 Thread Peter Otten
Speaking as someone who's not into dataclasses: This whole thread seems to be about spelling the initilizer's function signature as a class body. Have you considered going in the opposite direction, i. e. writing something like @dataclass class A: @attributes_from_signature def __init

[Python-ideas] Re: dataclasses: position-only and keyword-only fields

2021-03-14 Thread Eric V. Smith
Yeah, I'm beginning to see that positional args are going to make it unworkable. I'll write up another proposal with just normal args and keyword-only args. Thanks everyone for your feedback! Eric On 3/13/2021 8:19 PM, Matt Wozniski wrote: Oops, sent a reply too soon. On Sat, Mar 13, 2021 a

[Python-ideas] Re: Add an export keyword to better manage __all__

2021-03-14 Thread Theia Vogel
> You write about auto-populating `__all__`. I am not aware of it ever auto-populating. What are you referring to here? (The behavior that in the absence of `__all__`, everything not starting with `_` is exported, is not auto-population -- it's a default behavior implemented by `import *`, not by

[Python-ideas] Re: Add an export keyword to better manage __all__

2021-03-14 Thread Theia Vogel
> import the_module > the_module.sys > would work, but > from the_module import sys > would not work? > That might be odd and confusing. Good point. I'm not familiar with CPython internals so I'm not sure how this would work on the implementation side, but I definitely think it would be impor

[Python-ideas] Re: Add an export keyword to better manage __all__

2021-03-14 Thread Guido van Rossum
On Sun, Mar 14, 2021 at 7:11 AM Theia Vogel wrote: > > import the_module > > > the_module.sys > > > would work, but > > > from the_module import sys > > > would not work? > > > That might be odd and confusing. > > Good point. I'm not familiar with CPython internals so I'm not sure how > this woul

[Python-ideas] Re: Add an export keyword to better manage __all__

2021-03-14 Thread Stestagg
On Sun, 14 Mar 2021 at 18:58, Guido van Rossum wrote: > On Sun, Mar 14, 2021 at 7:11 AM Theia Vogel wrote: > >> > import the_module >> >> > the_module.sys >> >> > would work, but >> >> > from the_module import sys >> >> > would not work? >> >> > That might be odd and confusing. >> >> Good point.

[Python-ideas] Re: Add an export keyword to better manage __all__

2021-03-14 Thread Guido van Rossum
If you feel so strongly about it maybe we need to see some credentials. What's your background? (This may sound like an odd request, but reputation matters, and right now I have no idea who you are or why I should take your opinion seriously, no matter how eloquently it is stated.) Note that C ext

[Python-ideas] Re: dataclasses: position-only and keyword-only fields

2021-03-14 Thread Brendan Barnwell
On 2021-03-12 19:57, Eric V. Smith wrote: Basically, I want to add a flag, to each field, stating whether the field results in a normal parameter, a positional-only parameter, or a keyword-only parameter to __init__. Then when I'm generating __init__, I'll examine those flags and put the position

[Python-ideas] Re: Add an export keyword to better manage __all__

2021-03-14 Thread Stestagg
On Sun, Mar 14, 2021 at 8:22 PM Guido van Rossum wrote: > If you feel so strongly about it maybe we need to see some credentials. > What's your background? (This may sound like an odd request, but reputation > matters, and right now I have no idea who you are or why I should take your > opinion s

[Python-ideas] Re: Add an export keyword to better manage __all__

2021-03-14 Thread Guido van Rossum
Hi Steve, I don't think I can explain adequately why I challenged you, so I'll just apologize. Your feedback (about the 'export' proposal, and about my challenge of your credentials) is duly noted. Sorry! --Guido On Sun, Mar 14, 2021 at 4:11 PM Stestagg wrote: > On Sun, Mar 14, 2021 at 8:22 P

[Python-ideas] Re: Add an export keyword to better manage __all__

2021-03-14 Thread Ethan Furman
On 3/14/21 12:42 PM, Stestagg wrote: The value of being able to (in specific cases) reach into third-party code, and customize it to work for your specific situation should not be disregarded. I completely agree with this. One of the hallmarks of Python is the ability to query, introspect,