[Python-ideas] Re: Allow syntax "func(arg=x if condition)"

2021-03-20 Thread Paul Bryan
I've encountered the same issue, either matching the default values in the else clause (and hoping they won't later be changed) or having to revert to building a kwargs dict, and then in multiple `if` statements, conditionally including arguments. I've also felt this same pain building dicts with

[Python-ideas] Re: Itertools generator injection

2021-03-20 Thread David Mertz
I have very often wanted versions of itertools.product(), itertools.permutations(), and itertools.combinations() that don't concretize their iterators. They very much violate the spirit of itertools, and hard-lock my machine when I forget the bad design and try infinite iterators. I don't think w

[Python-ideas] Re: Itertools generator injection

2021-03-20 Thread Ben Rudiak-Gould
On Fri, Mar 19, 2021 at 8:59 PM Dennis Sweeney wrote: > I think these don't generally fit with the "feel" of the itertools module > though since almost everything there accepts iterables and returns iterators itertools.product as written barely seems to fit. It might as well accept only sequenc

[Python-ideas] Re: Allow syntax "func(arg=x if condition)"

2021-03-20 Thread Peter O'Connor
bump! On Wed, Jan 13, 2021 at 9:32 AM Peter O'Connor wrote: > I often find that python lacks a nice way to say "only pass an argument > under this condition". (See previous python-list email in "Idea: Deferred > Default Arguments?") > > Example 1: Defining a list with conditional elements >

[Python-ideas] Re: Looking for people interested in a Python register virtual machine project

2021-03-20 Thread David Mertz
It was (is). It was a VM idea. Taken from a 2001 April Fool's Day joke about Python and Perl merging. The goal of optimizing a register based VM independently of the grammars compiled to it seems smart. For a certain time our wonderful Alison Randall was even lead of it. The Python grammar must b

[Python-ideas] Re: Looking for people interested in a Python register virtual machine project

2021-03-20 Thread Skip Montanaro
Yes, I remember Parrot. As I understand it their original goal was a language-agnostic virtual machine, which might have complicated things. I will do a bit of reading and add some text to the "PEP." Skip On Sat, Mar 20, 2021, 11:36 AM David Mertz wrote: > The Parrot project was also intended

[Python-ideas] Re: Looking for people interested in a Python register virtual machine project

2021-03-20 Thread David Mertz
The Parrot project was also intended to be the same thing, and for a while had a fair number of contributors. Unfortunately, it never obtained the performance wins that were good for. On Sat, Mar 20, 2021, 11:55 AM Skip Montanaro wrote: > Back in the late 90s (!) I worked on a reimagining of the

[Python-ideas] Looking for people interested in a Python register virtual machine project

2021-03-20 Thread Skip Montanaro
Back in the late 90s (!) I worked on a reimagining of the Python virtual machine as a register-based VM based on 1.5.2. I got part of the way with that, but never completed it. In the early 2010s, Victor Stinner got much further using 3.4 as a base. The idea (and dormant code) has been laying aroun

[Python-ideas] Re: Itertools generator injection

2021-03-20 Thread Jonathan Fine
Hi I see two issues. The first is present behaviour. The second is alternative ways of ordering the elements of a Cartesian product. Here's an example of the present behaviour. >>> iter_range = iter(range(100)) >>> prod = itertools.product(iter_range, "abcdef") >>> next(iter_range)