Re: [Python-ideas] Ignorable whitespaces in the re.VERBOSE mode

2017-11-20 Thread Stephen J. Turnbull
All, If we *do* seriously consider adding those characters as ignorable in re.VERBOSE, that's because somebody is using them in text a lot, and it slips into their coding. Given frequent use, we should consider how a lot more whitespace characters can be conveniently searched individually and rea

Re: [Python-ideas] Ignorable whitespaces in the re.VERBOSE mode

2017-11-20 Thread Serhiy Storchaka
20.11.17 10:13, Stephen J. Turnbull пише: Otherwise I'm with Paul, who writes: > My instinct is not to worry about it unless someone has actually hit > the issue in practice and raised a bug. After the tabs vs. spaces fiasco, I lean steeply to the right for code -- including embedded langua

Re: [Python-ideas] Ignorable whitespaces in the re.VERBOSE mode

2017-11-20 Thread M.-A. Lemburg
For consistency, we should probably have "whitespace" for re equal to whatever "\s" matches, since this is what the engine itself considers as whitespace (and then also covers the special case where you use the re.ASCII flag). Still, the only practical case I could imagine, where extending the lis

[Python-ideas] Adding a new function "zip_flat" to itertools (Re: Rewriting the "roundrobin" recipe in the itertools documentation)

2017-11-20 Thread bunslow
Dear all: thank you for your replies and thoughts, most especially Steve and Terry. I am more-or-less new to contributing to Python, so I wasn't sure that the bug tracker was the best way to start -- I was looking for a sanity check and received exactly what I wanted :) Thanks to the feedback here,

Re: [Python-ideas] Adding a new function "zip_flat" to itertools (Re: Rewriting the "roundrobin" recipe in the itertools documentation)

2017-11-20 Thread Steven D'Aprano
Hi Bill, I don't have time to go through your email in detail and respond to every point you raise, but I'd like to respond to one point you made. On Mon, Nov 20, 2017 at 02:03:13AM -0600, bunslow wrote: > I also found this answer: > > https://stackoverflow.com/questions/243865/how-do-i-merge

Re: [Python-ideas] Adding a new function "zip_flat" to itertools (Re: Rewriting the "roundrobin" recipe in the itertools documentation)

2017-11-20 Thread Steven D'Aprano
Oops, a slight buglet in my test code: [Attachment: rr_tester.py] Change the constant NUMBER = 30 to the largest value you can bear for more reliable timing tests. I lowered the value for a quick test and forgot to increase it again. -- Steve ___

Re: [Python-ideas] Adding a new function "zip_flat" to itertools (Re: Rewriting the "roundrobin" recipe in the itertools documentation)

2017-11-20 Thread Terry Reedy
On 11/20/2017 11:08 AM, Steven D'Aprano wrote: Please don't make claims about correctness and efficiency without testing the code first. The second suggestion given there, using deque, is *not* correct as provided, as it fails to work with iterables. It requires the caller to pass only iterators

Re: [Python-ideas] Adding a new function "zip_flat" to itertools (Re: Rewriting the "roundrobin" recipe in the itertools documentation)

2017-11-20 Thread David Mertz
After correcting Terry's off-by-one error, I get this on Python 3.6 (and bumping NUMBER to 1000). In speed, Terry's is either very slightly faster or very slightly slower than the recipe, depending on the data. I think Terry's is more readable that roundrobin(), but still requires a little though

Re: [Python-ideas] A proliferation of (un-)Pythonically programmatic pragmas

2017-11-20 Thread Barry Warsaw
Chris Barker wrote: > but whatever -- multiple line pragmas are fine, too -- I'm hoping putting > this much crap in your code will be rare :-) For sure. It's not uncommon for you to need two pragmas, e.g. flake8 and coverage, but it's pretty rare to need those *plus* mypy. It does happen though

Re: [Python-ideas] Allow additional separator character in variables

2017-11-20 Thread Nikolaus Rath
On Nov 18 2017, Bruce Leban wrote: > And because spaces between words is mostly not valid syntax currently, this > change would be easier to introduce than breaking every single program out > there by re-purposing hyphen-minus. But I'm not seriously proposing this > because I think the modest bene

Re: [Python-ideas] Adding a new function "zip_flat" to itertools (Re: Rewriting the "roundrobin" recipe in the itertools documentation)

2017-11-20 Thread Steven D'Aprano
On Mon, Nov 20, 2017 at 12:15:50PM -0500, Terry Reedy wrote: > >Your version truncates the results to A B C instead of A B C D E as the > >itertools recipe gives. > > This is due to an off-by-1 error which I corrected 3 hours later in a > follow-up post, repeated below. Ah, I missed that, thank

Re: [Python-ideas] Looking for input to help with the pip situation

2017-11-20 Thread Chris Barker
On Fri, Nov 17, 2017 at 2:14 AM, Steve Barnes wrote: > > >>> On Wed, Nov 15, 2017 at 11:07 AM, Steve Dower > My preferred solution for this is to rename "py.exe" to "python.exe" > ... > > Note that renaming py.exe to python.exe would have several problems: > > ... I don't understand any

Re: [Python-ideas] Looking for input to help with the pip situation

2017-11-20 Thread Eric Fahlgren
​ On Mon, Nov 20, 2017 at 1:59 PM, Chris Barker wrote: > BTW -- does pip install a "pip3" on Windows? > ​ In 3.6 it does: > find t:/Python36/ -iname 'pip*exe' t:/Python36/Scripts/pip.exe t:/Python36/Scripts/pip3.6.exe t:/Python36/Scripts/pip3.exe ​ _

Re: [Python-ideas] Looking for input to help with the pip situation

2017-11-20 Thread Mark Lawrence
On 20/11/17 21:59, Chris Barker wrote: BTW -- does pip install a "pip3" on Windows? -CHB -- Christopher Barker, Ph.D. Oceanographer pip.exe, pip3.exe and pip3.6.exe are all in C:\Program Files\Python36\Scripts on my Windows 10 setup installed for all users. -- My fellow Pythonistas, ask

Re: [Python-ideas] Adding a new function "zip_flat" to itertools (Re: Rewriting the "roundrobin" recipe in the itertools documentation)

2017-11-20 Thread Terry Reedy
On 11/20/2017 4:57 PM, Steven D'Aprano wrote: On Mon, Nov 20, 2017 at 12:15:50PM -0500, Terry Reedy wrote: Your version truncates the results to A B C instead of A B C D E as the itertools recipe gives. This is due to an off-by-1 error which I corrected 3 hours later in a follow-up post, repe

Re: [Python-ideas] Looking for input to help with the pip situation

2017-11-20 Thread Paul Moore
On 20 November 2017 at 21:59, Chris Barker wrote: > I don't understand any of this enough to have an opinion, so while I'd like > to see py.exe be renamed python.exe, let's not let "the perfect be the enemy > of good enough". So, if someone can make the case that they can restructure > the whole p

Re: [Python-ideas] Looking for input to help with the pip situation

2017-11-20 Thread Paul Moore
>> BTW -- does pip install a "pip3" on Windows? > > No. Just "pip.exe". Looks like I should have checked. As others pointed out, it does (pip3.exe and pip3.6.exe). Apologies. Paul ___ Python-ideas mailing list Python-ideas@python.org https://mail.python.

Re: [Python-ideas] Looking for input to help with the pip situation

2017-11-20 Thread Chris Barker
On Mon, Nov 20, 2017 at 3:24 PM, Paul Moore wrote: > On 20 November 2017 at 21:59, Chris Barker wrote: > > I don't understand any of this enough to have an opinion, so while I'd > like > > to see py.exe be renamed python.exe, let's not let "the perfect be the > enemy > > of good enough". So, if

Re: [Python-ideas] Rewriting the "roundrobin" recipe in the itertools documentation

2017-11-20 Thread Terry Reedy
On 11/16/2017 5:57 PM, Terry Reedy wrote: On 11/16/2017 2:56 PM, Terry Reedy wrote: Correct off-by-one error.  I should have tested with an edge case such as print(list(roundrobin('ABC', ''))) The following combines 3 statements into one for statement. def roundrobin(*iterables): "roundr

Re: [Python-ideas] Consider (one day) adding an inheritance order class precedence mechanism

2017-11-20 Thread Neil Girdhar
On Sat, Nov 18, 2017 at 9:29 PM Nick Coghlan wrote: > On 19 November 2017 at 06:56, Neil Girdhar wrote: > > Would you mind explaining why it's necessary for C3 to complain? > > > > In: > > > > S < C > > B < S, E > > R < E, C > > Z < B, R > > > > If Z is told to have MRO: > > > > (Z, B, S, R, E,

Re: [Python-ideas] Adding a new function "zip_flat" to itertools (Re: Rewriting the "roundrobin" recipe in the itertools documentation)

2017-11-20 Thread bunslow
(Regarding the stackoverflow link, he does have a version that includes the trivial fix to apply iter() to args, at the bottom of the post.) I think that the variety of solutions with a variety of merits is indicative that it would be useful to have a "zip_flat" in the itertools module, but I gues

Re: [Python-ideas] Allow additional separator character in variables

2017-11-20 Thread Stephen J. Turnbull
Mikhail V writes: > On Mon, Nov 20, 2017 at 5:46 AM, Guido van Rossum wrote: > > Please kill this thread. > > So the idea is too bad? No, the idea is *not* bad, it's just not for Python. As has been true for every one of your ideas for language tweaks that I can recall. There are *million

[Python-ideas] Adding a thin wrapper class around the functions in stdlib.heapq

2017-11-20 Thread bunslow
Nothing so bombastic this time. The heapq functions are basically all named "heapsomething", and basically all take a "heap" for their first argument, with supplementary args coming after. It's a textbook example of the (hypothetical) Object Oriented Manifesto™ where defining a class increases type

Re: [Python-ideas] Ignorable whitespaces in the re.VERBOSE mode

2017-11-20 Thread Stephen J. Turnbull
Serhiy Storchaka writes: > I agree. But if there is a special part of the Unicode standard for > Pattern White Spaces which includes non-ASCII characters, perhaps there > is a need in them. I asked for the case if Python developers with very > different cultures have need in additional whit

Re: [Python-ideas] Consider (one day) adding an inheritance order class precedence mechanism

2017-11-20 Thread Nick Coghlan
On 21 November 2017 at 11:09, Neil Girdhar wrote: > > On Sat, Nov 18, 2017 at 9:29 PM Nick Coghlan wrote: >> >> >>> class C: pass >> ... >> >>> class S(C): pass >> ... >> >>> class E: pass >> ... >> >>> class B(S, E): pass >> ... >> >>> class R(E, C): pass >>

Re: [Python-ideas] Adding a thin wrapper class around the functions in stdlib.heapq

2017-11-20 Thread Sebastian Kreft
This has been brought up multiple times. Last time was on this thread https://mail.python.org/pipermail/python-ideas/2016-October/043024.html. On Tue, Nov 21, 2017 at 3:13 AM, bunslow wrote: > Nothing so bombastic this time. The heapq functions are basically all > named "heapsomething", and basi

Re: [Python-ideas] Consider (one day) adding an inheritance order class precedence mechanism

2017-11-20 Thread Nick Coghlan
On 21 November 2017 at 12:34, Nick Coghlan wrote: > Right, but once you do that, then the existing resolver is already > able to handle things: > > >>> class C: pass > ... > >>> class S(C): pass > ... > >>> class E: pass > ... > >>> class B(S, E, C): pass > ... >

Re: [Python-ideas] Consider (one day) adding an inheritance order class precedence mechanism

2017-11-20 Thread Neil Girdhar
On Mon, Nov 20, 2017 at 9:34 PM Nick Coghlan wrote: > On 21 November 2017 at 11:09, Neil Girdhar wrote: > > > > On Sat, Nov 18, 2017 at 9:29 PM Nick Coghlan wrote: > >> > >> >>> class C: pass > >> ... > >> >>> class S(C): pass > >> ... > >> >>> class E: pass > >> ... > >

Re: [Python-ideas] Adding a thin wrapper class around the functions in stdlib.heapq

2017-11-20 Thread bunslow
Perhaps such repetition is a sign that *something* needs to be done... Thanks for the link though. I'm new enough to the community that it didn't even occur to me to search for prior discussions. On Mon, Nov 20, 2017 at 8:38 PM, Sebastian Kreft wrote: > This has been brought up multiple times.

Re: [Python-ideas] Consider (one day) adding an inheritance order class precedence mechanism

2017-11-20 Thread Neil Girdhar
On Mon, Nov 20, 2017 at 9:41 PM Nick Coghlan wrote: > On 21 November 2017 at 12:34, Nick Coghlan wrote: > > Right, but once you do that, then the existing resolver is already > > able to handle things: > > > > >>> class C: pass > > ... > > >>> class S(C): pass > > ... > > >>>

Re: [Python-ideas] Allow additional separator character in variables

2017-11-20 Thread Mikhail V
On Tue, Nov 21, 2017 at 2:51 AM, Stephen J. Turnbull wrote: > Mikhail V writes: > > > On Mon, Nov 20, 2017 at 5:46 AM, Guido van Rossum wrote: > > > Please kill this thread. > > > > So the idea is too bad? > > No, the idea is *not* bad, it's just not for Python. As has been true > for every

Re: [Python-ideas] Adding a new function "zip_flat" to itertools (Re: Rewriting the "roundrobin" recipe in the itertools documentation)

2017-11-20 Thread Serhiy Storchaka
21.11.17 01:00, Terry Reedy пише: On 11/20/2017 4:57 PM, Steven D'Aprano wrote: Is there a reason for calling reversed() instead of reversing the order of range in the first place? range(len(iterables)-1, -1, -1) Readability.  Accurately and automatically reversing ranges was one of the use

Re: [Python-ideas] Allow additional separator character in variables

2017-11-20 Thread Serhiy Storchaka
21.11.17 05:16, Mikhail V пише: my·variable myᝍvariable myㅡvariable myⵧvariable myㄧvariable myㆍvariable ^ Is this good idea *for Python*? I mean this is not Python that I knew. I don't know how it is possible. Looks like a result of some unlucky nuclear experment. Might be it will not cause any

[Python-ideas] Should Python have user-defined constants?

2017-11-20 Thread Saeed Baig
Hey guys I am thinking of perhaps writing a PEP to introduce user-defined constants to Python. Something along the lines of Swift’s “let” syntax (e.g. “let pi = 3.14”). Do you guys think it would be a good idea? Why or why not? Do you think there’s a better way to do it? I’d like to know what o

Re: [Python-ideas] Should Python have user-defined constants?

2017-11-20 Thread INADA Naoki
I'm -1. I feel Python is complex language already. And I don't want make it more complicate. INADA Naoki On Tue, Nov 21, 2017 at 3:33 PM, Saeed Baig wrote: > Hey guys I am thinking of perhaps writing a PEP to introduce user-defined > constants to Python. Something along the lines of Swift’s “

Re: [Python-ideas] Should Python have user-defined constants?

2017-11-20 Thread Serhiy Storchaka
21.11.17 08:33, Saeed Baig пише: Hey guys I am thinking of perhaps writing a PEP to introduce user-defined constants to Python. Something along the lines of Swift’s “let” syntax (e.g. “let pi = 3.14”). Do you guys think it would be a good idea? Why or why not? Do you think there’s a better wa

Re: [Python-ideas] Should Python have user-defined constants?

2017-11-20 Thread Joseph Jevnik
How is that different from "pi = 3.14"? On Tue, Nov 21, 2017 at 1:33 AM, Saeed Baig wrote: > Hey guys I am thinking of perhaps writing a PEP to introduce user-defined > constants to Python. Something along the lines of Swift’s “let” syntax (e.g. > “let pi = 3.14”). > > Do you guys think it would

Re: [Python-ideas] Looking for input to help with the pip situation

2017-11-20 Thread Steve Barnes
On 21/11/2017 00:32, Chris Barker wrote: > On Mon, Nov 20, 2017 at 3:24 PM, Paul Moore > wrote: > > On 20 November 2017 at 21:59, Chris Barker > wrote: > > I don't understand any of this enough to have an opinion, so >