Daniel Moisset writes:
> For the likely rare situation where I'd want to do this rather than
> refactoring into a function, I might try with something like this without
> requiring changes to the language:
> @contextmanager
> def breakable():
Of course this doesn't address Serhiy's case whe
Hello,
It would be nice to have a simple and easy way to override module
importing, instead of that babylon which CPython has in that regard.
(Even if initially "limited" to filesystem importing, most people
won't ever find that limiting at all.)
The desired semantics would be:
For "import foo",
And how would Python compute the "full basename of the file to be
imported"?
How could it guess among all directories on sys.path the one containing
the "file", and check if it is a file or a package without going through
the existing mechanism?
Maybe this proposal is good - but possibly, just cu
Hello,
On Tue, 8 Dec 2020 07:29:15 -0300
"Joao S. O. Bueno" wrote:
> And how would Python compute the "full basename of the file to be
> imported"?
The way it does it usually.
> How could it guess among all directories on sys.path the one
> containing the "file", and check if it is a file or a
On Tue, Dec 8, 2020 at 9:54 PM Paul Sokolovsky wrote:
>
> Hello,
>
> On Tue, 8 Dec 2020 07:29:15 -0300
> "Joao S. O. Bueno" wrote:
>
> > And how would Python compute the "full basename of the file to be
> > imported"?
>
> The way it does it usually.
>
That involves a number of searches for exact
I am not sure if this has been suggested before, so my apologies if it has.
I would like to propose adding lazy types for casting builtins in a lazy
fashion. e.g. `lazy_tuple` which creates a reference to the source iterable and
a morally immutable sequence but only populates the tupular contain
Hello,
On Tue, 8 Dec 2020 22:32:42 +1100
Chris Angelico wrote:
> On Tue, Dec 8, 2020 at 9:54 PM Paul Sokolovsky
> wrote:
> >
> > Hello,
> >
> > On Tue, 8 Dec 2020 07:29:15 -0300
> > "Joao S. O. Bueno" wrote:
> >
> > > And how would Python compute the "full basename of the file to be
> > > im
Hello,
On Tue, 08 Dec 2020 11:46:59 -
"Mathew Elman" wrote:
> I am not sure if this has been suggested before, so my apologies if
> it has.
>
> I would like to propose adding lazy types for casting builtins in a
> lazy fashion. e.g. `lazy_tuple` which creates a reference to the
> source ite
On Tue, Dec 8, 2020 at 11:05 PM Paul Sokolovsky wrote:
> > It'd be best to
> > just write what you want directly, using the tools in importlib.
>
> Of course, the implementation of the above for CPython would be based on
> importlib. And other implementations could implement that "directly",
> for
Hello,
On Wed, 9 Dec 2020 02:01:58 +1100
Chris Angelico wrote:
> On Tue, Dec 8, 2020 at 11:05 PM Paul Sokolovsky
> wrote:
> > > It'd be best to
> > > just write what you want directly, using the tools in importlib.
> >
> > Of course, the implementation of the above for CPython would be
> > ba
On Mon, Dec 7, 2020 at 6:27 PM Daniel Moisset wrote:
> For the likely rare situation where I'd want to do this rather than
> refactoring into a function, I might try with something like this without
> requiring changes to the language:
>
> from contextlib import contextmanager
>
> @contextmanager
On Tue, Dec 8, 2020 at 3:31 PM Ricky Teachey wrote:
> I agree with the person who called this a brilliant solution. Here is the
> code from the link for completeness:
>
I'm not diss'ing the approach. But it doesn't really save that much over a
sentinel variable `break_to_middle`. And if you wa
On Tue, Dec 8, 2020 at 10:42 AM David Mertz wrote:
> On Tue, Dec 8, 2020 at 3:31 PM Ricky Teachey wrote:
>
>> I agree with the person who called this a brilliant solution. Here is the
>> code from the link for completeness:
>>
>
> I'm not diss'ing the approach. But it doesn't really save that m
PyOxidizer's pure Rust implementation of a meta path importer (
https://pyoxidizer.readthedocs.io/en/stable/oxidized_importer_oxidized_finder.html)
has been surprisingly effective at finding corner cases and behavior quirks
in Python's importing mechanisms.
It was recently brought to my attention
On 08.12.2020 20:47, Gregory Szorc wrote:
> Anyway, I was encouraged by Brett Cannon to email this list to assess the
> appetite for introducing a backwards incompatible change to this behavior. So
> here's my strawman/hardline proposal:
>
> 1. 3.10 introduces a DeprecationWarning for "__init__" a
On Tue, 2020-12-08 at 11:47 -0800, Gregory Szorc wrote:
> PyOxidizer's pure Rust implementation of a meta path importer
> (https://pyoxidizer.readthedocs.io/en/stable/oxidized_importer_oxidized_finder.html
> ) has been surprisingly effective at finding corner cases and behavior quirks
> in Python's
On Tue, Dec 08, 2020 at 08:06:09PM +, Filipe Laíns wrote:
> I support this change.
Can you explain why you support this breaking change?
I am especially interested in cases where people accidentally, or
inadvertently, imported "package.__init__" and then used it without
realising that it i
On Tue, Dec 08, 2020 at 11:47:22AM -0800, Gregory Szorc wrote:
> It was recently brought to my attention via
> https://github.com/indygreg/PyOxidizer/issues/317 that "__init__" in module
> names is something that exists in Python code in the wild.
Can we be clear whether you are talking about "__
On Tue, Dec 8, 2020 at 2:44 PM Steven D'Aprano wrote:
> On Tue, Dec 08, 2020 at 11:47:22AM -0800, Gregory Szorc wrote:
>
> > It was recently brought to my attention via
> > https://github.com/indygreg/PyOxidizer/issues/317 that "__init__" in
> module
> > names is something that exists in Python c
On Tue, Dec 08, 2020 at 11:46:59AM -, Mathew Elman wrote:
> I would like to propose adding lazy types for casting builtins in a
> lazy fashion. e.g. `lazy_tuple` which creates a reference to the
> source iterable and a morally immutable sequence but only populates
> the tupular container wh
On Tue, Dec 08, 2020 at 03:07:48PM -0800, Gregory Szorc wrote:
> We're talking about "__init__" being the exact name of a module component.
> `"__init__" in fullname.split(".")`, as I wrote in my initial email.
I'm sorry, you've just added more confusion to me, rather than less :-(
What's a modu
Hi
I like using itertools for creating long strings while not paying the cost of
intermediate strings (by eventually calling str.join on the whole iterator).
However, one missing feature is to mimic the behavior of str.join as an
iterator: an iterator that returns the items of an iterable, separ
22 matches
Mail list logo