Re: [Python-ideas] + operator on generators

2017-06-26 Thread Serhiy Storchaka
26.06.17 13:47, Joao S. O. Bueno пише: On 25 June 2017 at 20:55, Danilo J. S. Bellini > wrote: On Sun, Jun 25, 2017 at 3:06 PM, lucas via Python-ideas >wrote:

Re: [Python-ideas] A suggestion for a do...while loop

2017-06-26 Thread Todd
On Jun 26, 2017 2:15 AM, "Chris Angelico" wrote: On Mon, Jun 26, 2017 at 4:08 PM, Terry Reedy wrote: >> If we wanted to allow that to be expressed literally, we could >> probably special case the "while not break" keyword sequence as a do >> loop: >> >>

Re: [Python-ideas] + operator on generators

2017-06-26 Thread Sven R. Kunze
Personally, I find syntactic sugar for concating interators would come in handy. The purpose of iterators and generators is performance and efficiency. So, lowering the bar of using them is a good idea IMO. Also hoping back and forth a generator/iterator-based solution and a, say,

Re: [Python-ideas] Reducing collisions in small dicts/sets

2017-06-26 Thread MRAB
On 2017-06-26 19:21, Tim Peters wrote: Some explanations and cautions. An advantage of sticking with pure Python instead of C is that spare moments are devoted to investigating the problem instead of thrashing with micro-optimizations ;-) Why does the current scheme suffer for small tables?

Re: [Python-ideas] Reducing collisions in small dicts/sets

2017-06-26 Thread Tim Peters
[MRAB ] > If the current scheme suffers only for small tables, couldn't you use an > alternative scheme only for small tables? Sure. But whether that's desirable partly depends on timing actual C code. Try it ;-) For maintenance sanity, it's obviously better to have

Re: [Python-ideas] + operator on generators

2017-06-26 Thread Koos Zevenhoven
On Mon, Jun 26, 2017 at 4:53 PM, Serhiy Storchaka wrote: > 26.06.17 13:47, Joao S. O. Bueno пише: > >> On 25 June 2017 at 20:55, Danilo J. S. Bellini > > wrote: >> >> On Sun, Jun 25, 2017 at 3:06 PM, lucas via

Re: [Python-ideas] A suggestion for a do...while loop

2017-06-26 Thread Ethan Furman
On 06/26/2017 01:20 PM, Mikhail V wrote: I dont't like "while True:" simply because it does not make enough visual distinction with the "while condition:" statement. My "while True:" loops look something like: while "": -- ~Ethan~ ___

Re: [Python-ideas] A suggestion for a do...while loop

2017-06-26 Thread Cameron Simpson
On 26Jun2017 13:30, Ethan Furman wrote: On 06/26/2017 01:20 PM, Mikhail V wrote: I dont't like "while True:" simply because it does not make enough visual distinction with the "while condition:" statement. My "while True:" loops look something like: while "": O_o

Re: [Python-ideas] Reducing collisions in small dicts/sets

2017-06-26 Thread Tim Peters
[Tim] >... I haven't yet thought of a cheap way to compute an > `inc` for double-hashing that isn't vulnerable to bad behavior for > _some_ easily constructed set of int keys. If you forget "cheap", > it's easy; e.g., > > random.seed(h) > inc = random.choice(range(1, mask + 1, 2)) Heh.

[Python-ideas] A suggestion for a do...while loop

2017-06-26 Thread Mikhail V
>All these situations could be handled by making a "while:" with no >condition act as "while True:" >But they could also be handled by updating pep8 to make "while True:" the >recommended infinite loop syntax and make linters smarter about this (if >they aren't already). There was a big related

Re: [Python-ideas] + operator on generators

2017-06-26 Thread Wes Turner
On Sunday, June 25, 2017, Wes Turner wrote: > > > On Sunday, June 25, 2017, Danilo J. S. Bellini > wrote: > >> On Sun, Jun 25, 2017 at 3:06 PM, lucas via Python-ideas < >>

Re: [Python-ideas] A suggestion for a do...while loop

2017-06-26 Thread Joao S. O. Bueno
and "while not except" :-/ maybe we just stick with "while True' and put forward a documenting PEP advising linter packages to look for ways of getting out of the loop. On 26 June 2017 at 08:08, Terry Reedy wrote: > On 6/26/2017 12:41 AM, Nick Coghlan wrote: > >> On 26 June

Re: [Python-ideas] A suggestion for a do...while loop

2017-06-26 Thread Terry Reedy
On 6/26/2017 12:41 AM, Nick Coghlan wrote: On 26 June 2017 at 10:25, Rob Cliffe wrote: On 25/06/2017 12:58, Markus Meskanen wrote: I'm a huge fan of the do...while loop in other languages, and it would often be useful in Python too, when doing stuff like: while

Re: [Python-ideas] A suggestion for a do...while loop

2017-06-26 Thread Chris Angelico
On Mon, Jun 26, 2017 at 2:41 PM, Nick Coghlan wrote: > If we wanted to allow that to be expressed literally, we could > probably special case the "while not break" keyword sequence as a do > loop: > > while not break: > # Setup > if condition: break >

Re: [Python-ideas] A suggestion for a do...while loop

2017-06-26 Thread Chris Angelico
On Mon, Jun 26, 2017 at 4:08 PM, Terry Reedy wrote: >> If we wanted to allow that to be expressed literally, we could >> probably special case the "while not break" keyword sequence as a do >> loop: >> >> while not break: >> # Setup >> if condition: break

Re: [Python-ideas] A suggestion for a do...while loop

2017-06-26 Thread Greg Ewing
Chris Angelico wrote: And for completeness, "while not throw:". And just to completely confuse everyone, "while not pass". :-) -- Greg ___ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code

Re: [Python-ideas] A suggestion for a do...while loop

2017-06-26 Thread Chris Angelico
On Mon, Jun 26, 2017 at 7:22 PM, Greg Ewing wrote: > And just to completely confuse everyone, "while not pass". :-) while "gandalf": ChrisA ___ Python-ideas mailing list Python-ideas@python.org

Re: [Python-ideas] + operator on generators

2017-06-26 Thread Joao S. O. Bueno
On 25 June 2017 at 20:55, Danilo J. S. Bellini wrote: > On Sun, Jun 25, 2017 at 3:06 PM, lucas via Python-ideas < > python-ideas@python.org> wrote: > >> I often use generators, and itertools.chain on them. >> What about providing something like the following: >> >>