[Python-Dev] Re: Declarative imports

2022-04-09 Thread Dan Stromberg
On Fri, Apr 8, 2022 at 1:26 AM Malthe wrote: > This is an idea which has been brought up before, sometimes introduced > as "heresy". But an interesting twist has surfaced now which is > typing. > What for? To save a few keystrokes? Can't some IDE's add the import for you? Please don't drag

[Python-Dev] Re: C API: Move PEP 523 "Adding a frame evaluation API to CPython" private C API to the internal C API

2022-04-09 Thread Nick Coghlan
On Thu, 7 Apr 2022, 8:02 pm Petr Viktorin, wrote: > > This applies to: > > - Functions added in PEP 523 > - PyCode_New, PyCode_NewWithPosOnlyArgs > - Ideally anything documented as subject to change between minor > releases. (To be kind to users, if something is added later we should > again

[Python-Dev] Re: C API: Move PEP 523 "Adding a frame evaluation API to CPython" private C API to the internal C API

2022-04-09 Thread Nick Coghlan
On Thu, 7 Apr 2022, 8:02 pm Petr Viktorin, wrote: > So here's my proposal: > > - This API stays with the regular public API (Include/cpython/), but to > use it you'll need to #define Py_USING_UNSTABLE_API (name up for > bikeshedding). > I'm fine with the rest of what you suggest, but I don't

[Python-Dev] Re: Importing a submodule doesn't always set an attribute on its parent

2022-04-09 Thread Eric V. Smith
On 4/9/2022 4:28 PM, Terry Reedy wrote: On 4/9/2022 5:09 AM, Arfrever Frehtes Taifersar Arahesis wrote: Not only deletion, but also random assignments: Ok.  Change "Manual deletion of entries from sys.modules" to "Direct manipulation of sys.modules" I'm not sure it's worth the hassle to

[Python-Dev] Re: Importing a submodule doesn't always set an attribute on its parent

2022-04-09 Thread dfremont--- via Python-Dev
Thanks, Brett. I understand why the behavior happens, I just don't understand the decision to implement imports this way. Since there's no warning in the documentation that removing items from sys.modules can break the fact that "import X.Y" defines "X.Y" (note that the "behind the curtain"

[Python-Dev] Re: Importing a submodule doesn't always set an attribute on its parent

2022-04-09 Thread Terry Reedy
On 4/9/2022 5:09 AM, Arfrever Frehtes Taifersar Arahesis wrote: 2022-04-09 04:24 UTC, Terry Reedy は書いた: Perhaps something intentionally vague like "Manual deletion of entries from sys.modules may invalidate statements above, even after re-imports." or "Manual deletion of entries from

[Python-Dev] Re: Importing a submodule doesn't always set an attribute on its parent

2022-04-09 Thread Christopher Barker
> Not only deletion, but also random assignments: > > >>> import sys > >>> import collections.abc > >>> sys.modules['collections'] = 1 > >>> import collections.abc > >>> collections.abc > Traceback (most recent call last): > File "", line 1, in > AttributeError: 'int' object has no attribute

[Python-Dev] Re: Declarative imports

2022-04-09 Thread Carl Meyer via Python-Dev
Hi Malthe, On Fri, Apr 8, 2022 at 12:04 PM Malthe wrote: > Actually, to me the interesting idea is not so much lazy imports – I > think they should not be lazy, at least that was my initial thought. I > think they should be immediately resolved before anything else in that > module: I'm +0.25

[Python-Dev] Re: About PEPs being discussed on Discourse

2022-04-09 Thread Baptiste Carvello
Hi, Le 08/04/2022 à 15:34, Petr Viktorin a écrit : > > I follow Discourse by e-mail, in the "Mailing list mode", where > Discourse sends me all comments and I filter in the e-mail client. That > works rather well for me. If this is so, is there a possibility to funnel the message stream through

[Python-Dev] Re: About PEPs being discussed on Discourse

2022-04-09 Thread Stephen J. Turnbull
Brett Cannon writes: > On Thu, Apr 7, 2022 at 7:33 PM Stephen J. Turnbull < > stephenjturnb...@gmail.com> wrote: > > The specific mention of "community moderation" and "thread management" > > makes me suspect that part of that effect is due to increased cost of > > participation for casual

[Python-Dev] Re: Declarative imports

2022-04-09 Thread Carl Meyer via Python-Dev
Hi Barry, On Fri, Apr 8, 2022 at 12:44 PM Barry Warsaw wrote: > > Start up overhead due to imports is a real problem for some class of > applications, e.g. CLIs, and I’ve seen a lot of hacks implemented to get > Python CLIs to be more responsive. E.g. getting from invocation to —help >

[Python-Dev] Re: Importing a submodule doesn't always set an attribute on its parent

2022-04-09 Thread Arfrever Frehtes Taifersar Arahesis
2022-04-09 04:24 UTC, Terry Reedy は書いた: > Perhaps something intentionally vague like > > "Manual deletion of entries from sys.modules may invalidate statements > above, even after re-imports." > > or > > "Manual deletion of entries from sys.modules may result in surprising > behavior, even after