Re: [Python-Dev] PEP 8 modernisation

2013-08-03 Thread Steven D'Aprano
On 02/08/13 06:52, Alexander Belopolsky wrote: On Thu, Aug 1, 2013 at 4:29 PM, Terry Reedy wrote: def f(x): return 2*x f = lambda x: 2*x Am I the only one who finds the second line above much more readable than the first? The def statement is not intended to be written in one line. The r

Re: [Python-Dev] PEP 8 modernisation

2013-08-03 Thread Nick Coghlan
On 4 Aug 2013 11:30, "Alexander Belopolsky" wrote: > > > On Thu, Aug 1, 2013 at 8:44 AM, Nick Coghlan wrote: > > > > 9. Explicit guideline not to assign lambdas to names (use def, that's > > what it's for) > > > Would you consider changing the formatting in the recommended example from > > def f(

Re: [Python-Dev] PEP 8 modernisation

2013-08-03 Thread Alexander Belopolsky
On Thu, Aug 1, 2013 at 8:44 AM, Nick Coghlan wrote: > > 9. Explicit guideline not to assign lambdas to names (use def, that's > what it's for) Would you consider changing the formatting in the recommended example from def f(x): return 2*x to def f(x): return 2*x ? What is the modern vie

Re: [Python-Dev] PEP 8 modernisation

2013-08-02 Thread Alexander Shorin
On Fri, Aug 2, 2013 at 1:10 PM, Nick Coghlan wrote: > Lambda was almost removed in Python 3. > >> >> Using `dict` to store lambdas: >> >> > op = { 'add': lambda x,y: x*y, 'mul': lambda x, y: x+y} >> >> Shows the hack to bypass PEP8 guides. Do you like to see code above >> instead of: >> >> add =

Re: [Python-Dev] PEP 8 modernisation

2013-08-02 Thread Nick Coghlan
On 2 Aug 2013 17:31, "Alexander Shorin" wrote: > > Hi Terry, > > On Fri, Aug 2, 2013 at 12:29 AM, Terry Reedy wrote: > > def f(x): return 2*x > > f = lambda x: 2*x > > Three spaces is seldom a crucial difference. If the expression is so long it go past the limit (whatever we decide it is), it can

Re: [Python-Dev] PEP 8 modernisation

2013-08-02 Thread Alexander Shorin
Hi Terry, On Fri, Aug 2, 2013 at 12:29 AM, Terry Reedy wrote: > def f(x): return 2*x > f = lambda x: 2*x > Three spaces is seldom a crucial difference. If the expression is so long it > go past the limit (whatever we decide it is), it can be wrapped. and if I have multiple lambda-like def`s it

Re: [Python-Dev] PEP 8 modernisation

2013-08-01 Thread Nick Coghlan
On 2 Aug 2013 01:18, "Alexander Belopolsky" wrote: > > > On Thu, Aug 1, 2013 at 10:21 AM, R. David Murray wrote: >> >> > I'm guessing it's short enough you can say you tried, but long >> > enough to annoy traditionalists anyway. >> > >> > I'm annoyed already. :-) >> >> +1 :) > > > +1 :) > > I re

Re: [Python-Dev] PEP 8 modernisation

2013-08-01 Thread Brian Curtin
On Thu, Aug 1, 2013 at 3:44 PM, Brian Curtin wrote: > On Thu, Aug 1, 2013 at 3:36 PM, Terry Reedy wrote: >> On 8/1/2013 11:03 AM, Alexander Shorin wrote: >>> >>> ...and, if so, why lambda's?(: Without backward compatibility point I >>> see that they are getting "unofficially" deprecated and their

Re: [Python-Dev] PEP 8 modernisation

2013-08-01 Thread Terry Reedy
On 8/1/2013 11:35 AM, Alexander Belopolsky wrote: Here is one use-case where .. = lambda .. cannot be replaced with def .. op['add'] = lambda x,y: x+y op['mul'] = lambda x, y: x*y Yes, you are binding the functions to named slots, not to names, so not covered by the PEP. Once might still wa

Re: [Python-Dev] PEP 8 modernisation

2013-08-01 Thread Alexander Belopolsky
On Thu, Aug 1, 2013 at 4:29 PM, Terry Reedy wrote: > def f(x): return 2*x > f = lambda x: 2*x > Am I the only one who finds the second line above much more readable than the first? The def statement is not intended to be written in one line. The readability suffers because the argument is sepa

Re: [Python-Dev] PEP 8 modernisation

2013-08-01 Thread Brian Curtin
On Thu, Aug 1, 2013 at 3:36 PM, Terry Reedy wrote: > On 8/1/2013 11:03 AM, Alexander Shorin wrote: >> >> ...and, if so, why lambda's?(: Without backward compatibility point I >> see that they are getting "unofficially" deprecated and their usage is >> dishonoured. > > > Please stop both the top-po

Re: [Python-Dev] PEP 8 modernisation

2013-08-01 Thread Terry Reedy
On 8/1/2013 11:03 AM, Alexander Shorin wrote: ...and, if so, why lambda's?(: Without backward compatibility point I see that they are getting "unofficially" deprecated and their usage is dishonoured. Please stop both the top-posting and the FUD. -- Terry Jan Reedy

Re: [Python-Dev] PEP 8 modernisation

2013-08-01 Thread Terry Reedy
On 8/1/2013 10:48 AM, Alexander Shorin wrote: I understand this, but I'm a bit confused about fate of lambdas with such guideline since I see no more reasons to use them with p.9 statement: long lines, code duplicate, no mock and well tests etc. - all these problems could be solved with assigning

Re: [Python-Dev] PEP 8 modernisation

2013-08-01 Thread Terry Reedy
On 8/1/2013 10:34 AM, Alexander Shorin wrote: Hi Nick, On Thu, Aug 1, 2013 at 4:44 PM, Nick Coghlan wrote: 9. Explicit guideline not to assign lambdas to names (use def, that's what it's for) Even for propose to fit chars-per-line limit def f(x): return 2*x f = lambda x: 2*x Three spaces

Re: [Python-Dev] PEP 8 modernisation

2013-08-01 Thread Barry Warsaw
On Aug 01, 2013, at 11:52 AM, R. David Murray wrote: >So as we edit the docs, we re-wrap. Just like we do with the legacy >code :) +1! -Barry ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscr

Re: [Python-Dev] PEP 8 modernisation

2013-08-01 Thread R. David Murray
On Thu, 01 Aug 2013 11:35:38 -0400, Barry Warsaw wrote: > So I would greatly prefer that stdlib files be kept to the 79 character > limit. I see most violations of this in the library documents, but especially > there, paragraphs should be wrapped to 79 characters, and can easily be done > withou

Re: [Python-Dev] PEP 8 modernisation

2013-08-01 Thread Alexander Belopolsky
On Thu, Aug 1, 2013 at 11:03 AM, Alexander Shorin wrote: > ...and, if so, why lambda's?(: Without backward compatibility point I > see that they are getting "unofficially" deprecated and their usage is > dishonored. > > Here is one use-case where .. = lambda .. cannot be replaced with def .. op

Re: [Python-Dev] PEP 8 modernisation

2013-08-01 Thread Barry Warsaw
On Aug 01, 2013, at 11:05 AM, Alexander Belopolsky wrote: >I will start experimenting with 100-char limit, but I think it is still too >wide for auto-wrapped text. Maybe we should have a stronger >recommendation to keep 80-char limit for docstrings and other embedded >text. It is OK to have an

Re: [Python-Dev] PEP 8 modernisation

2013-08-01 Thread Alexander Belopolsky
On Thu, Aug 1, 2013 at 10:21 AM, R. David Murray wrote: > > I'm guessing it's short enough you can say you tried, but long > > enough to annoy traditionalists anyway. > > > > I'm annoyed already. :-) > > +1 :) +1 :) I recently gave up and reset default auto-wrap margin to 120 locally. This ch

Re: [Python-Dev] PEP 8 modernisation

2013-08-01 Thread Ronald Oussoren
On 1 Aug, 2013, at 17:03, Alexander Shorin wrote: > ...and, if so, why lambda's?(: Without backward compatibility point I > see that they are getting "unofficially" deprecated and their usage is > dishonoured. They are still usefull for simple functions that you use in one place, such as the ke

Re: [Python-Dev] PEP 8 modernisation

2013-08-01 Thread Antoine Pitrou
Le Thu, 1 Aug 2013 23:21:49 +1000, Nick Coghlan a écrit : > On 1 August 2013 23:10, Antoine Pitrou wrote: > > Le Thu, 1 Aug 2013 22:44:12 +1000, > > Nick Coghlan a écrit : > >> 4. Lines up to 99 characters are now permitted (but 79 is still the > >> preferred limit) > > > > Something magic about

Re: [Python-Dev] PEP 8 modernisation

2013-08-01 Thread R. David Murray
On Thu, 01 Aug 2013 16:53:16 +0200, Ronald Oussoren wrote: > On 1 Aug, 2013, at 16:48, Alexander Shorin wrote: > > I understand this, but I'm a bit confused about fate of lambdas with > > such guideline since I see no more reasons to use them with p.9 > > statement: long lines, code duplicate, n

Re: [Python-Dev] PEP 8 modernisation

2013-08-01 Thread Alexander Shorin
...and, if so, why lambda's?(: Without backward compatibility point I see that they are getting "unofficially" deprecated and their usage is dishonoured. -- ,,,^..^,,, On Thu, Aug 1, 2013 at 6:53 PM, Ronald Oussoren wrote: > > On 1 Aug, 2013, at 16:48, Alexander Shorin wrote: > >> Hi Ronald, >

Re: [Python-Dev] PEP 8 modernisation

2013-08-01 Thread Skip Montanaro
> http://mail.python.org/pipermail/python-list/2013-July/653046.html One correspondent objected that I was artificial biasing my histogram because wrapped lines are, more-or-less by definition, going to be < 80 characters. Off-list I responded with a modified version of my graph where I eliminate

Re: [Python-Dev] PEP 8 modernisation

2013-08-01 Thread Steven D'Aprano
On 01/08/13 22:44, Nick Coghlan wrote: With feedback from Guido, Barry, Raymond and others, I have updated PEP 8 to better describe our current development practices. It started as an update to describe the different between public and internal interfaces and to advise against using wildcard impo

Re: [Python-Dev] PEP 8 modernisation

2013-08-01 Thread Ronald Oussoren
On 1 Aug, 2013, at 16:48, Alexander Shorin wrote: > Hi Ronald, > > I understand this, but I'm a bit confused about fate of lambdas with > such guideline since I see no more reasons to use them with p.9 > statement: long lines, code duplicate, no mock and well tests etc. - > all these problems c

Re: [Python-Dev] PEP 8 modernisation

2013-08-01 Thread Alexander Shorin
Hi Ronald, I understand this, but I'm a bit confused about fate of lambdas with such guideline since I see no more reasons to use them with p.9 statement: long lines, code duplicate, no mock and well tests etc. - all these problems could be solved with assigning lambda to some name, but now they a

Re: [Python-Dev] PEP 8 modernisation

2013-08-01 Thread LD 'Gus' Landis
On Thu, Aug 1, 2013 at 8:31 AM, Steven D'Aprano wrote: > On 01/08/13 22:44, Nick Coghlan wrote: > > 4. Lines up to 99 characters are now permitted (but 79 is still the >> preferred limit) >> > > Coincidentally, there was a discussion about line length on python-list > over the last couple of da

Re: [Python-Dev] PEP 8 modernisation

2013-08-01 Thread Ronald Oussoren
On 1 Aug, 2013, at 16:34, Alexander Shorin wrote: > Hi Nick, > > On Thu, Aug 1, 2013 at 4:44 PM, Nick Coghlan wrote: >> 9. Explicit guideline not to assign lambdas to names (use def, that's >> what it's for) > > Even for propose to fit chars-per-line limit and/or to remove > duplicates (espec

Re: [Python-Dev] PEP 8 modernisation

2013-08-01 Thread Alexander Shorin
Hi Nick, On Thu, Aug 1, 2013 at 4:44 PM, Nick Coghlan wrote: > 9. Explicit guideline not to assign lambdas to names (use def, that's > what it's for) Even for propose to fit chars-per-line limit and/or to remove duplicates (especially for sorted groupby case)? -- ,,,^..^,,,

Re: [Python-Dev] PEP 8 modernisation

2013-08-01 Thread Steven D'Aprano
On 01/08/13 22:44, Nick Coghlan wrote: 4. Lines up to 99 characters are now permitted (but 79 is still the preferred limit) Coincidentally, there was a discussion about line length on python-list over the last couple of days. I think the two most relevant comments are by Skip Montanaro: ht

Re: [Python-Dev] PEP 8 modernisation

2013-08-01 Thread R. David Murray
On Thu, 01 Aug 2013 09:16:13 -0400, Fred Drake wrote: > On Thu, Aug 1, 2013 at 9:10 AM, Antoine Pitrou wrote: > > Something magic about 99? > > I'm guessing it's short enough you can say you tried, but long > enough to annoy traditionalists anyway. > > I'm annoyed already. :-) +1 :) My termi

Re: [Python-Dev] PEP 8 modernisation

2013-08-01 Thread Nick Coghlan
On 1 August 2013 23:10, Antoine Pitrou wrote: > Le Thu, 1 Aug 2013 22:44:12 +1000, > Nick Coghlan a écrit : >> 4. Lines up to 99 characters are now permitted (but 79 is still the >> preferred limit) > > Something magic about 99? One less than 100, same as 79 is one less than 80. The "100" came f

Re: [Python-Dev] PEP 8 modernisation

2013-08-01 Thread Fred Drake
On Thu, Aug 1, 2013 at 9:10 AM, Antoine Pitrou wrote: > Something magic about 99? I'm guessing it's short enough you can say you tried, but long enough to annoy traditionalists anyway. I'm annoyed already. :-) -Fred -- Fred L. Drake, Jr. "A storm broke loose in my mind." --Albert Ein

Re: [Python-Dev] PEP 8 modernisation

2013-08-01 Thread Antoine Pitrou
Le Thu, 1 Aug 2013 22:44:12 +1000, Nick Coghlan a écrit : > 4. Lines up to 99 characters are now permitted (but 79 is still the > preferred limit) Something magic about 99? cheers Antoine. ___ Python-Dev mailing list Python-Dev@python.org http://mai

[Python-Dev] PEP 8 modernisation

2013-08-01 Thread Nick Coghlan
With feedback from Guido, Barry, Raymond and others, I have updated PEP 8 to better describe our current development practices. It started as an update to describe the different between public and internal interfaces and to advise against using wildcard imports, but became substantially more :) Fo