On Tue, 23 Oct 2012 17:24:34 -0600, Ian Kelly wrote:
> On Tue, Oct 23, 2012 at 4:34 PM, Steven D'Aprano
> wrote:
>> On Tue, 23 Oct 2012 10:50:11 -0600, Ian Kelly wrote:
>>
if someone is foolish enough to use the
from xyz import *
notation...
>>>
>>> It's already a
On Tue, Oct 23, 2012 at 4:34 PM, Steven D'Aprano
wrote:
> On Tue, 23 Oct 2012 10:50:11 -0600, Ian Kelly wrote:
>
>>> if someone is foolish enough to use the
>>>
>>> from xyz import *
>>>
>>> notation...
>>
>> It's already a SyntaxError to use a wildcard import anywhere other than
>> the mo
On Tue, 23 Oct 2012 10:50:11 -0600, Ian Kelly wrote:
>> if someone is foolish enough to use the
>>
>> from xyz import *
>>
>> notation...
>
> It's already a SyntaxError to use a wildcard import anywhere other than
> the module level, so its use can only affect global variables.
In Python
On Mon, Oct 22, 2012 at 7:39 PM, Dennis Lee Bieber
wrote:
> On Mon, 22 Oct 2012 16:02:34 -0600, Ian Kelly
> declaimed the following in gmane.comp.python.general:
>
>> On my wishlist for Python is a big, fat SyntaxError for any variable
>> that could be interpreted as either local or nonlocal and
On 23/10/2012, Dennis Lee Bieber wrote:
> On Mon, 22 Oct 2012 16:02:34 -0600, Ian Kelly
> declaimed the following in gmane.comp.python.general:
>
>> On my wishlist for Python is a big, fat SyntaxError for any variable
>> that could be interpreted as either local or nonlocal and is not
>> explicit
On Mon, Oct 22, 2012 at 1:03 AM, Chris Angelico wrote:
> Python's system "just works" most of
> the time, but can introduce yet another trap for the unsuspecting
> newbie who doesn't understand the difference between rebinding and
> mutating; I've not looked into multiple levels of closures but I
Roy Smith wrote:
> Pet peeve of the day...
>
> Why do you have to write:
>
> global foo
> foo = 4
>
> when
>
> global foo = 4
>
> would have been so much easier?
To make it more annoying for people who use globals, duh. :)
Ramit Prasad
This email is confidential and subject to important dis
In article <5084e819$0$29897$c3e8da3$54964...@news.astraweb.com>,
Steven D'Aprano wrote:
> On Mon, 22 Oct 2012 07:22:18 +1100, Chris Angelico wrote:
>
> > On Mon, Oct 22, 2012 at 6:11 AM, Steven D'Aprano
> > wrote:
>
> >>> Ahh. I totally didn't see that, I'm way too used to reading past
> >>>
On Mon, Oct 22, 2012 at 5:30 PM, Steven D'Aprano
wrote:
> For languages without static types, what other reasons for declaring
> variables are there?
The main one is scope nesting. Compare a few different languages.
Python: If you don't declare, it's global if you don't rebind it, but
local if y
On Mon, 22 Oct 2012 07:22:18 +1100, Chris Angelico wrote:
> On Mon, Oct 22, 2012 at 6:11 AM, Steven D'Aprano
> wrote:
>>> Ahh. I totally didn't see that, I'm way too used to reading past
>>> typos.
>>
>> As a programmer, doesn't that screw up your debugging ability?
>
> Reading-past-typos appli
On Sat, 20 Oct 2012 16:37:23 -0400, Roy Smith wrote:
> sys.stderr.write("Error: Can't find the file 'settings.py'
> in the directory containing %r.\nYou'll have to run django-profile.py,
> passing it your settings module.\n(If the file settings.py does indeed
> exist, it's causing an
On 21 October 2012 21:38, Chris Angelico wrote:
> On Mon, Oct 22, 2012 at 7:19 AM, Roy Smith wrote:
> > Of course, the same can happen in Python. I could do:
> >
> > foo = "default value"
> > if blah == 47:
> >fooo = "some other value"
> > print foo
> >
> > No syntax error, no NameError, ju
On Mon, Oct 22, 2012 at 7:19 AM, Roy Smith wrote:
> Of course, the same can happen in Python. I could do:
>
> foo = "default value"
> if blah == 47:
>fooo = "some other value"
> print foo
>
> No syntax error, no NameError, just the wrong thing printing.
Yeah, that's the worst kind of bug. No
On Mon, Oct 22, 2012 at 6:11 AM, Steven D'Aprano
wrote:
> On Sun, 21 Oct 2012 22:43:07 +1100, Chris Angelico wrote:
>
>> On Sun, Oct 21, 2012 at 9:00 PM, Steven D'Aprano
>> wrote:
>>> Er, no. Note spelling of "source code" vs "souce code". Hence the grin.
>>
>> Ahh. I totally didn't see that, I'm
In article ,
Grant Edwards wrote:
> On 2012-10-21, Steven D'Aprano wrote:
> > On Sun, 21 Oct 2012 22:43:07 +1100, Chris Angelico wrote:
> >
> >> On Sun, Oct 21, 2012 at 9:00 PM, Steven D'Aprano
> >> wrote:
> >>> Er, no. Note spelling of "source code" vs "souce code". Hence the grin.
> >>
> >>
On 2012-10-21, Steven D'Aprano wrote:
> On Sun, 21 Oct 2012 22:43:07 +1100, Chris Angelico wrote:
>
>> On Sun, Oct 21, 2012 at 9:00 PM, Steven D'Aprano
>> wrote:
>>> Er, no. Note spelling of "source code" vs "souce code". Hence the grin.
>>
>> Ahh. I totally didn't see that, I'm way too used to
On Sun, 21 Oct 2012 22:43:07 +1100, Chris Angelico wrote:
> On Sun, Oct 21, 2012 at 9:00 PM, Steven D'Aprano
> wrote:
>> Er, no. Note spelling of "source code" vs "souce code". Hence the grin.
>
> Ahh. I totally didn't see that, I'm way too used to reading past typos.
As a programmer, doesn't t
On 20/10/12 15:18, Grant Edwards wrote:
On 2012-10-20, Dennis Lee Bieber wrote:
Strangely, we've gone from 80-character fixed width displays to
who-knows-what (if I drop my font size I can probably get nearly 200
characters across in full-screen mode)...
But at the same time w
On Sun, Oct 21, 2012 at 9:00 PM, Steven D'Aprano
wrote:
> Er, no. Note spelling of "source code" vs "souce code". Hence the grin.
Ahh. I totally didn't see that, I'm way too used to reading past
typos. Sure. Printing out *source* code, that's altogether different.
Me, though, I don't print anyth
On Sunday 21 October 2012 07:02:26 Steven D'Aprano did opine:
> On Sat, 20 Oct 2012 14:18:47 +, Grant Edwards wrote:
> > On 2012-10-20, Dennis Lee Bieber wrote:
> >>Strangely, we've gone from 80-character fixed width displays to
> >>
> >> who-knows-what (if I drop my font size I can prob
On 10/21/12 05:00, Steven D'Aprano wrote:
> I seriously do print out source code. When I'm having trouble
> seeing how the parts of a module fit together, reading print-outs
> is a good way around the problem.
I don't print my personal code--both in light of the fact that I
know it much more intim
On Sun, 21 Oct 2012 20:20:41 +1100, Chris Angelico wrote:
> On Sun, Oct 21, 2012 at 7:07 PM, Steven D'Aprano
> wrote:
>> On Sat, 20 Oct 2012 14:18:47 +, Grant Edwards wrote:
>>> True, but nobody prints source code out on paper do they?
>>
>> I do.
>>
>> There's nothing better than spreading o
On Sun, Oct 21, 2012 at 7:07 PM, Steven D'Aprano
wrote:
> On Sat, 20 Oct 2012 14:18:47 +, Grant Edwards wrote:
>> True, but nobody prints source code out on paper do they?
>
> I do.
>
> There's nothing better than spreading out a dozen sheets of source code
> over a table to get a good, high-l
On Sat, 20 Oct 2012 14:18:47 +, Grant Edwards wrote:
> On 2012-10-20, Dennis Lee Bieber wrote:
>
>> Strangely, we've gone from 80-character fixed width displays to
>> who-knows-what (if I drop my font size I can probably get nearly 200
>> characters across in full-screen mode)...
>>
>>
In article <5081d0c3$0$30003$c3e8da3$54964...@news.astraweb.com>,
Steven D'Aprano wrote:
> Some code might be more conveniently written as a single long line. But I
> would argue that nearly never is code more easily *read* as a single long
> line, and since code is read much more than it is w
On Sat, 20 Oct 2012 14:18:47 +, Grant Edwards wrote:
> True, but nobody prints source code out on paper do they?
>
> Seriously -- I can't remember the last time I printed souce code...
I remember my first IT job - COBOL programming in the early 80's. The
rule was that every time we delivere
On Sat, Oct 20, 2012 at 3:10 PM, Dennis Lee Bieber
wrote:
> On Sat, 20 Oct 2012 14:18:47 + (UTC), Grant Edwards
> declaimed the following in
> gmane.comp.python.general:
>
>>
>> True, but nobody prints source code out on paper do they?
>>
>> Seriously -- I can't remember the last time I print
On 20 October 2012 15:18, Grant Edwards wrote:
> On 2012-10-20, Dennis Lee Bieber wrote:
>
> > Strangely, we've gone from 80-character fixed width displays to
> > who-knows-what (if I drop my font size I can probably get nearly 200
> > characters across in full-screen mode)...
> >
> >
On 2012-10-20, Dennis Lee Bieber wrote:
> Strangely, we've gone from 80-character fixed width displays to
> who-knows-what (if I drop my font size I can probably get nearly 200
> characters across in full-screen mode)...
>
> But at the same time we've gone from 132-character line-prin
On Oct 20, 8:27 am, Tim Chase wrote:
> On 10/19/12 17:14, Steven D'Aprano wrote:
>
> > Code never *needs* to be long, because it can always be shortened.
>
> I advocate one bit per line:
>
> 1
> 0
> 1
> 0
> 0
> 1
> 0
> 1
> 1
> 0
> 0
> 1
> 0
> 1
> 1
> 1
> 0
> 0
> 0
> 0
> 1
> 1
> 1
> 0
> 1
> 1
> 0
>
On 10/19/12 17:14, Steven D'Aprano wrote:
> Code never *needs* to be long, because it can always be shortened.
I advocate one bit per line:
1
0
1
0
0
1
0
1
1
0
0
1
0
1
1
1
0
0
0
0
1
1
1
0
1
1
0
0
1
1
0
1
1
0
0
1
1
1
1
0
0
1
1
1
1
1
1
1
«grins, ducks, and flees»
Shortenedly-yers,
-tkc
--
http
On Fri, 19 Oct 2012 11:21:06 +0200, Jean-Michel Pichavant wrote:
> Using 80+ char lines doesn't mean
> I put all my efforts exceeding the 80 char limit.
I didn't say it did. I was describing some of the reasons people might
choose to stick to the 79 character limit, beyond the reason you gave,
On Thursday, October 18, 2012 12:06:43 AM UTC-6, Zero Piraeus wrote:
> :
>
>
>
> Okay, so, first thing vaguely Python-related that comes to mind [so
>
> probably not even slightly original, but then that's not really the
>
> point]:
>
>
>
> What are people's preferred strategies for dealing
On 2012-10-18, at 6:34 PM, Steven D'Aprano
wrote:
> Flame away :)
This post made my Friday, even though I'm sitting on a nearly two hour bus ride
into work because I missed my commuter train. Just wanted you to know ;) You
noted *every* reason (and them some) why my own code never passed 79
- Original Message -
[snipe 80 char line discussion]
> And, quite frankly, people who care more about the readability of
> their
> code than about squeezing in as much processing into a single line of
> text as possible.
>
As usual Steven, you take someone's argument, you add a little
On Thu, 18 Oct 2012 20:35:20 -0700, rusi wrote:
(extracting the text without the ASCII-art)
> > “When I get new information, I change my position. What, sir,
> > do you do with new information?” —John Maynard Keynes
> > “Anyone who believes exponential growth can go on forever in a
> > finite wor
> \ “When I get new information, I change my position. What, sir, |
> `\ do you do with new information?” —John Maynard Keynes |
> _o__) |
> \ “Anyone who believes exponential growth can go on forever in a
On 10/18/2012 09:20 PM, Steven D'Aprano wrote:
> On Thu, 18 Oct 2012 12:47:48 -0400, Dave Angel wrote:
>
>> I never use the backslash at end-of-line to continue a statement to the
>> next. Not only is it a readability problem, but if your editor doesn't
>> have visible spaces, you can accidentally
On Thu, 18 Oct 2012 17:36:57 -0400, Zero Piraeus wrote:
> The accepted rule in print is that lines of prose should be between 45
> and 90 characters, with 66 being ideal for readability. Code is not
> prose, and the combination of fixed-width and much more variable line
> length aids readability,
On Thu, 18 Oct 2012 15:59:18 +0200, Jean-Michel Pichavant wrote:
> - Original Message -
>> On 2012-10-18, Zero Piraeus wrote:
>>
>> > What are people's preferred strategies for dealing with lines that go
>> > over 79 characters? A few I can think of off the bat:
>>
>> I try to do what's
On Thu, 18 Oct 2012 12:47:48 -0400, Dave Angel wrote:
> I never use the backslash at end-of-line to continue a statement to the
> next. Not only is it a readability problem, but if your editor doesn't
> have visible spaces, you can accidentally have whitespace after the
> backslash, and wonder wh
Jean-Michel Pichavant writes:
> The 79 char limit purpose is to allow someone to read the code on a 80
> char terminal (and allow old printers to print the code).
There is a very good reason for a strict line width limit regardless of
terminal size: scanning long lines is cognitively more diffic
Hans Mulder writes:
> On 18/10/12 08:31:51, Steven D'Aprano wrote:
> > some_variable = spam('x') + ham(
> > some_longer_variables, here_and_here,
> > and_here_also)
The indentation level for continuation lines shouldn't be dependent on
the content of the
Zero Piraeus writes:
> :
>
(Why is this colon appearing at the top of your messages? Can you remove
it if it's not germane?)
> What are people's preferred strategies for dealing with lines that go
> over 79 characters? A few I can think of off the bat:
> 1. Say "screw it" and go past 79, PEP8
On Thursday 18 October 2012 18:40:52 Grant Edwards did opine:
> On 2012-10-18, Den wrote:
> > On Wednesday, October 17, 2012 11:06:43 PM UTC-7, Zero Piraeus wrote:
> >> What are people's preferred strategies for dealing with lines that go
> >
> >> over 79 characters? A few I can think of off the
:
On 18 October 2012 11:55, Den wrote:
> [...] I'm amused by the whole question, and others related
> to PEP8. A quick aside, the width of our roads all go back to the
> width of a two horse rig. The suggested maximum of 80 characters goes
> back to teletype machines, and IBM cards, and charact
On Thu, Oct 18, 2012 at 10:47 AM, Dave Angel wrote:
> I never use the backslash at end-of-line to continue a statement to the
> next. Not only is it a readability problem, but if your editor doesn't
> have visible spaces, you can accidentally have whitespace after the
> backslash, and wonder what
Hans Mulder wrote:
> On 18/10/12 08:31:51, Steven D'Aprano wrote:
> > On Thu, 18 Oct 2012 02:06:19 -0400, Zero Piraeus wrote:
> >> 3. Say "well, at least it's not a backslash" and break the line using
> >> > parentheses.
> > I mostly do this. Since most lines include a bracket of some sort, I
> > r
Chris Angelico wrote:
> On Fri, Oct 19, 2012 at 3:13 AM, Neil Cerutti wrote:
> > Though technology has moved along swiftly, keeping your code
> > accessible to the guy using a crummy old console xterm might
> > still be worthwhile, and it makes printouts easy to create.
>
> And keeping your inte
On 18 October 2012 12:05, Tim Chase wrote:
> On 10/18/12 04:33, wxjmfa...@gmail.com wrote:
> > I use a "double indentation".
> >
> if 'asdf' and 'asdf' and 'asdf' \
> > ... 'asdf' and 'asdf' and \
> > ... 'asdf' and 'asdf':
> > ... print('do if')
> > ... s = 'asdf'
>
Den wrote:
> On Wednesday, October 17, 2012 11:06:43 PM UTC-7, Zero Piraeus wrote:
> > :
> >
> >
> > What are people's preferred strategies for dealing with lines that go
> >
> > over 79 characters? A few I can think of off the bat:
> >
>
> I personally just keep typing until my statement is finis
On 2012-10-18, Den wrote:
> On Wednesday, October 17, 2012 11:06:43 PM UTC-7, Zero Piraeus wrote:
>
>> What are people's preferred strategies for dealing with lines that go
>>
>> over 79 characters? A few I can think of off the bat:
>
> I personally just keep typing until my statement is finished
On 10/18/2012 12:58 PM, Chris Kaynor wrote:
> On Thu, Oct 18, 2012 at 9:47 AM, Dave Angel wrote:
>
>>
>> But both C++ and Python have automatic concatenation of adjacent
>> strings. So you can just start and end each line with a quote, and
>> leave off the backslash.
>>
> That will work in C++ a
On Thu, Oct 18, 2012 at 9:47 AM, Dave Angel wrote:
> On 10/18/2012 12:26 PM, Chris Angelico wrote:
> > On Fri, Oct 19, 2012 at 3:16 AM, Evan Driscoll
> wrote:
> >>Python isn't as bad as C++ though (my main other language), where
> >>80 characters can go by *very* quickly.
> >>
> >> 2. Ba
On 10/18/2012 12:26 PM, Chris Angelico wrote:
> On Fri, Oct 19, 2012 at 3:16 AM, Evan Driscoll wrote:
>>Python isn't as bad as C++ though (my main other language), where
>>80 characters can go by *very* quickly.
>>
>> 2. Backslash continuations are *terrible*. I hate them with a firery
>>
On Fri, Oct 19, 2012 at 3:16 AM, Evan Driscoll wrote:
>Python isn't as bad as C++ though (my main other language), where
>80 characters can go by *very* quickly.
>
> 2. Backslash continuations are *terrible*. I hate them with a firery
>passion. :-) A line could be 1000 characters long
On Fri, Oct 19, 2012 at 3:13 AM, Neil Cerutti wrote:
> Though technology has moved along swiftly, keeping your code
> accessible to the guy using a crummy old console xterm might
> still be worthwhile, and it makes printouts easy to create.
And keeping your interface accessible to someone who can
On Fri, Oct 19, 2012 at 2:49 AM, Dan Stromberg wrote:
> In fact, I tend to do lots of "otherwise pointless" variables, because I
> want to be able to quickly and easily insert print statements/functions
> without having to split up large commands, during debugging.
When will we next have a langu
Ooo, a good religious war. How could I resist? :-) Bear in mind that
what I say is relative to layout issues, which in the grand scheme of
things. So even if I say I really disklike something, it's still not so
bad in practice. Except for backslash continuations. :-)
On 10/18/2012 01:06 AM, Zero
On 2012-10-18, Den wrote:
> But I have to say I'm amused by the whole question, and others
> related to PEP8. A quick aside, the width of our roads all go
> back to the width of a two horse rig. The suggested maximum of
> 80 characters goes back to teletype machines, and IBM cards,
> and charact
On Wednesday, October 17, 2012 11:06:43 PM UTC-7, Zero Piraeus wrote:
> :
>
>
> What are people's preferred strategies for dealing with lines that go
>
> over 79 characters? A few I can think of off the bat:
>
I personally just keep typing until my statement is finished. This is my
program,
On Wed, Oct 17, 2012 at 11:06 PM, Zero Piraeus wrote:
> :
>
> Okay, so, first thing vaguely Python-related that comes to mind [so
> probably not even slightly original, but then that's not really the
> point]:
>
> What are people's preferred strategies for dealing with lines that go
> over 79 cha
- Original Message -
> On 2012-10-18, Zero Piraeus wrote:
>
> > What are people's preferred strategies for dealing with lines that
> > go
> > over 79 characters? A few I can think of off the bat:
>
> I try to do what's easiest to read and understand. Sometimes that
> means using a line
On 2012-10-18, Zero Piraeus wrote:
> What are people's preferred strategies for dealing with lines that go
> over 79 characters? A few I can think of off the bat:
I try to do what's easiest to read and understand. Sometimes that
means using a line thats 120 characters long, sometimes that means
On 10/18/12 04:33, wxjmfa...@gmail.com wrote:
> I use a "double indentation".
>
if 'asdf' and 'asdf' and 'asdf' \
> ... 'asdf' and 'asdf' and \
> ... 'asdf' and 'asdf':
> ... print('do if')
> ... s = 'asdf'
> ... ss = 'asdf'
> ...
> do if
if looks_like_it
:
There seems to be a consensus [to the extent there ever is, anyway]
around using parentheses etc., then ...
On 18 October 2012 02:31, Steven D'Aprano
wrote:
> I've been burnt enough by word-wrapping in editors that don't handle word-
> wrapping that well that it makes me really uncomfortable t
On Thu, Oct 18, 2012 at 8:07 PM, Hans Mulder wrote:
>
> if looks_like_it_might_be_spam(
> some_longer_variables,
> here_and_here, and_here_also):
> logger.notice("might be spam")
> move_to_spam_folder(some_longer_variables)
> update_spam_statistics(here_and_here)
>
This wants
Le jeudi 18 octobre 2012 11:07:25 UTC+2, Hans Mulder a écrit :
> On 18/10/12 08:31:51, Steven D'Aprano wrote:
>
> > On Thu, 18 Oct 2012 02:06:19 -0400, Zero Piraeus wrote:
>
> >> 3. Say "well, at least it's not a backslash" and break the line using
>
> >> > parentheses.
>
> > I mostly do this.
On 18/10/2012 07:06, Zero Piraeus wrote:
:
Okay, so, first thing vaguely Python-related that comes to mind [so
probably not even slightly original, but then that's not really the
point]:
What are people's preferred strategies for dealing with lines that go
over 79 characters? A few I can think
On 18/10/12 08:31:51, Steven D'Aprano wrote:
> On Thu, 18 Oct 2012 02:06:19 -0400, Zero Piraeus wrote:
>> 3. Say "well, at least it's not a backslash" and break the line using
>> > parentheses.
> I mostly do this. Since most lines include a bracket of some sort, I
> rarely need to add outer parent
Zero Piraeus writes:
> 2. Say "screw it" and break the line using a backslash.
Often the line will break ok without a backslash, but I don't feel any
particular pain in using a backslash in the other cases.
I do pretty rigorously try to keep all lines shorter than 72 columns or
so, unless there'
On Oct 18, 11:06 am, Zero Piraeus wrote:
> :
>
> Okay, so, first thing vaguely Python-related that comes to mind [so
> probably not even slightly original, but then that's not really the
> point]:
>
> What are people's preferred strategies for dealing with lines that go
> over 79 characters? A few
> 3. Say "well, at least it's not a backslash" and break the line using
> parentheses.
This. More times than not, there's a function call in that line, which
makes sense to me when reading it if the args are on the next line.
> 4. Spend 45 minutes trying to think up shorter [but still sensible]
>
On Thu, 18 Oct 2012 02:06:19 -0400, Zero Piraeus wrote:
> What are people's preferred strategies for dealing with lines that go
> over 79 characters? A few I can think of off the bat:
>
> 1. Say "screw it" and go past 79, PEP8 be damned.
I've been burnt enough by word-wrapping in editors that do
On Thu, Oct 18, 2012 at 5:06 PM, Zero Piraeus wrote:
> What are people's preferred strategies for dealing with lines that go
> over 79 characters? A few I can think of off the bat:
>
> 1. Say "screw it" and go past 79, PEP8 be damned.
>
> 6. Realise that if it's that long, it probably shouldn't ha
:
Okay, so, first thing vaguely Python-related that comes to mind [so
probably not even slightly original, but then that's not really the
point]:
What are people's preferred strategies for dealing with lines that go
over 79 characters? A few I can think of off the bat:
1. Say "screw it" and go p
76 matches
Mail list logo