Re: [Python-ideas] Spelling of Assignment Expressions PEP 572 (was post #4)

2018-04-14 Thread Ethan Furman
On 04/14/2018 08:08 PM, Nick Coghlan wrote: New keyword based target first proposal: while (value from read_next_item()) is not None: ... I could get behind this. Current preferencs: "as" +1 "from" +0.85 ":=" +0.5 -- ~Ethan~

[Python-ideas] A cute Python implementation of itertools.tee

2018-04-14 Thread Tim Peters
Just for fun - no complaint, no suggestion, just sharing a bit of code that tickled me. The docs for `itertools.tee()` contain a Python work-alike, which is easy to follow. It gives each derived generator its own deque, and when a new value is obtained from the original iterator it pushes that

Re: [Python-ideas] Spelling of Assignment Expressions PEP 572 (was post #4)

2018-04-14 Thread Chris Angelico
On Sun, Apr 15, 2018 at 1:08 PM, Nick Coghlan wrote: > === Target first, 'from' keyword === > > while (value from read_next_item()) is not None: # New > ... > > Pros: > > * avoids the syntactic ambiguity of "as" > * being target first provides an obvious

Re: [Python-ideas] Spelling of Assignment Expressions PEP 572 (was post #4)

2018-04-14 Thread Nick Coghlan
On 13 April 2018 at 23:18, Steven D'Aprano wrote: > On Fri, Apr 13, 2018 at 09:56:35PM +1000, Chris Angelico wrote: > > >> How many times have people asked for "with (expr as name):" to >> be supported, allowing the statement to spread over multiple lines? >> With this

Re: [Python-ideas] Move optional data out of pyc files

2018-04-14 Thread Neil Schemenauer
On 2018-04-12, M.-A. Lemburg wrote: > This leaves the proposal to restructure pyc files into a sectioned > file and possibly indexed file to make access to (lazily) loaded > parts faster. I would like to see a format can hold one or more modules in a single file. Something like the zip format

Re: [Python-ideas] Proposal: A Reduce-Map Comprehension and a "last" builtin

2018-04-14 Thread Danilo J. S. Bellini
On 5 April 2018 at 13:52, Peter O'Connor wrote: > I was thinking it would be nice to be able to encapsulate this common type > of operation into a more compact comprehension. > > I propose a new "Reduce-Map" comprehension that allows us to write: > > signal =

Re: [Python-ideas] Idea: Importing from arbitrary filenames

2018-04-14 Thread Terry Reedy
On 4/13/2018 11:28 PM, Ken Hilton wrote: Hi all, First of all, please excuse me if I'm presenting this idea in the wrong way or at the wrong time - I'm new to this mailing list and haven't seen anyone propose a new idea on it yet, so I don't know the customs. I have an idea for importing

Re: [Python-ideas] Idea: Importing from arbitrary filenames

2018-04-14 Thread Steve Barnes
On 14/04/2018 06:27, Nick Coghlan wrote: > On 14 April 2018 at 13:28, Ken Hilton wrote: >> Hi all, >> >> First of all, please excuse me if I'm presenting this idea in the wrong way >> or at the wrong time - I'm new to this mailing list and haven't seen anyone >> propose a

Re: [Python-ideas] Spelling of Assignment Expressions PEP 572 (was post #4)

2018-04-14 Thread Nikolaus Rath
On Apr 14 2018, Chris Angelico wrote: > On Fri, Apr 13, 2018 at 11:30 PM, Peter O'Connor > wrote: >> Well this may be crazy sounding, but we could allow left or right assignment >> with >>