Re: A Bug By Any Other Name ...

2009-08-03 Thread J. Cliff Dyer
On Sun, 2009-08-02 at 14:14 +, Albert van der Horst wrote: > >This is actually quite thoroughly untrue. In python, *indentation* > is > >significant. Whitespace (internal to a line) is not. You can even > call > >methods like this if you want: > > You totally don't get it. You describe how

Re: A Bug By Any Other Name ...

2009-08-02 Thread Albert van der Horst
In article , J. Cliff Dyer wrote: >On Fri, 2009-07-17 at 20:53 +, Albert van der Horst wrote: >> Because unlike in algol 68 in python whitespace is relevant, >> we could get by with requiring whitespace: >> x= -q # okay >> a> 8 ** -2

Re: A Bug By Any Other Name ...

2009-07-18 Thread Tom Kermode
Maybe the IDE is the best place to warn you of something like that. You could have an IDE where you specify which language you're more familiar with and then have it display warnings likely to be relevant to you. People could collaborate to add support for gradually more niche languages. Python

Re: A Bug By Any Other Name ...

2009-07-17 Thread MRAB
J. Cliff Dyer wrote: On Fri, 2009-07-17 at 20:53 +, Albert van der Horst wrote: Because unlike in algol 68 in python whitespace is relevant, we could get by with requiring whitespace: x= -q # okay a This is actually quite thoroughly untrue. In python,

Re: A Bug By Any Other Name ...

2009-07-17 Thread J. Cliff Dyer
On Fri, 2009-07-17 at 20:53 +, Albert van der Horst wrote: > Because unlike in algol 68 in python whitespace is relevant, > we could get by with requiring whitespace: > x= -q # okay > a 8 ** -2 # okay This is actually quite thor

Re: A Bug By Any Other Name ...

2009-07-17 Thread Albert van der Horst
In article , Gabriel Genellina wrote: >En Mon, 06 Jul 2009 00:28:43 -0300, Steven D'Aprano > escribi?: >> On Mon, 06 Jul 2009 14:32:46 +1200, Lawrence D'Oliveiro wrote: >> >>> I wonder how many people have been tripped up by the fact that >>> >>> ++n >>> >>> and >>> >>> --n >>> >>> fail si

Re: A Bug By Any Other Name ...

2009-07-16 Thread rwwh
On Jul 7, 2:00 pm, Steven D'Aprano wrote: > On Mon, 06 Jul 2009 22:18:20 -0700, Chris Rebert wrote: > >> Not so rare. Decimal uses unary plus. Don't assume +x is a no-op. > [...] > > Well, yes, but when would you apply it twice in a row? > > My point was that unary + isn't a no-op, and therefore n

Re: A Bug By Any Other Name ...

2009-07-13 Thread Lawrence D'Oliveiro
In message , MRAB wrote: > I wonder whether the problem with assignment in conditionals in C is due > to the assignment operator being "=". If it was ":=", would the error > still occur? One of the original C designers, Kernighan or Ritchie, admitted that he made the assignment operator "=" ins

Re: A Bug By Any Other Name ...

2009-07-13 Thread Lawrence D'Oliveiro
In message <4a538a71$0$30236$9b4e6...@newsspool1.arcor-online.net>, Stefan Behnel wrote: > Lawrence D'Oliveiro wrote: >> >> I wonder how many people have been tripped up by the fact that >> >> ++n >> >> and >> >> --n >> >> fail silently for numeric-valued n. > > I doubt that there ar

Re: A Bug By Any Other Name ...

2009-07-08 Thread Daniel Fetchinson
>> But this academic discussion is honestly a little pointless. The OP >> was referring to a expectation, coming from C, that is not fulfilled >> in python. What's wrong with mentioning it somewhere for the sake of >> helping C programmers? >> > And where does one stop? After all, my primary

RE: A Bug By Any Other Name ...

2009-07-07 Thread Phil Runciman
-Original Message- From: Dennis Lee Bieber [mailto:wlfr...@ix.netcom.com] Sent: Tuesday, 7 July 2009 4:45 p.m. To: python-list@python.org Subject: Re: A Bug By Any Other Name ... On Mon, 6 Jul 2009 19:48:39 -0700, Daniel Fetchinson declaimed the following in gmane.comp.python.general

Re: A Bug By Any Other Name ...

2009-07-07 Thread Stefan Behnel
Lawrence D'Oliveiro wrote: > I wonder how many people have been tripped up by the fact that > > ++n > > and > > --n > > fail silently for numeric-valued n. I doubt that there are many. Plus, you misspelled them from the more obvious n++ and n-- which *do* fail with

Re: A Bug By Any Other Name ...

2009-07-07 Thread MRAB
Daniel Fetchinson wrote: and my point is that users are most of time correct when they assume that something will work the same way as in C. Oh, really ? They would surely be wrong if they'd expect the for loop to have any similarity with a C for loop, or - a *very* common error - if they'd expe

Re: A Bug By Any Other Name ...

2009-07-07 Thread Daniel Fetchinson
>> and my point is that users >> are most of time correct when they assume that something will work the >> same way as in C. > > Oh, really ? They would surely be wrong if they'd expect the for loop to > have any similarity with a C for loop, or - a *very* common error - if > they'd expect assignme

Re: A Bug By Any Other Name ...

2009-07-07 Thread Daniel Fetchinson
Yes, there are plenty of languages other than Java and C, but the influence of C is admittedly huge in Python. Why do you think loops are called "for", conditionals "if" or "while", functions return via "return", loops terminate via "break" and keep going via "continue" and

Re: A Bug By Any Other Name ...

2009-07-07 Thread Daniel Fetchinson
> (snip) >> and my point is that users >> are most of time correct when they assume that something will work the >> same way as in C. > > Oh, really ? They would surely be wrong if they'd expect the for loop to > have any similarity with a C for loop, or - a *very* common error - if > they'd expect

Re: A Bug By Any Other Name ...

2009-07-07 Thread Dave Angel
Duncan Booth wrote: Dennis Lee Bieber wrote: for, if, and return were common keywords in FORTRAN. Really? What does 'for' do in FORTRAN? P.S. Does FORTRAN actually have keywords these days? Back when I learned it there was no such thing as a reserved word though for all I know they

Re: A Bug By Any Other Name ...

2009-07-07 Thread MRAB
Dennis Lee Bieber wrote: On Mon, 6 Jul 2009 19:48:39 -0700, Daniel Fetchinson declaimed the following in gmane.comp.python.general: Yes, there are plenty of languages other than Java and C, but the influence of C is admittedly huge in Python. Why do you think loops are called "for", conditiona

Re: A Bug By Any Other Name ...

2009-07-07 Thread Steven D'Aprano
On Mon, 06 Jul 2009 22:18:20 -0700, Chris Rebert wrote: >> Not so rare. Decimal uses unary plus. Don't assume +x is a no-op. [...] > Well, yes, but when would you apply it twice in a row? My point was that unary + isn't a no-op, and therefore neither is ++. For Decimal, I can't think why you'd w

Re: A Bug By Any Other Name ...

2009-07-07 Thread Bruno Desthuilliers
Daniel Fetchinson a écrit : Yes, there are plenty of languages other than Java and C, but the influence of C is admittedly huge in Python. Why do you think loops are called "for", conditionals "if" or "while", functions return via "return", loops terminate via "break" and keep going via "continue

Re: A Bug By Any Other Name ...

2009-07-07 Thread Bruno Desthuilliers
Daniel Fetchinson a écrit : (snip) and my point is that users are most of time correct when they assume that something will work the same way as in C. Oh, really ? They would surely be wrong if they'd expect the for loop to have any similarity with a C for loop, or - a *very* common error - if

Re: A Bug By Any Other Name ...

2009-07-07 Thread Duncan Booth
Dennis Lee Bieber wrote: > for, if, and return were common keywords in FORTRAN. Really? What does 'for' do in FORTRAN? P.S. Does FORTRAN actually have keywords these days? Back when I learned it there was no such thing as a reserved word though for all I know they may have since added them.

Re: A Bug By Any Other Name ...

2009-07-06 Thread Chris Rebert
On Mon, Jul 6, 2009 at 10:13 PM, Steven D'Aprano wrote: > On Tue, 07 Jul 2009 04:51:51 +, Lie Ryan wrote: > >> Chris Rebert wrote: >>> On Mon, Jul 6, 2009 at 1:29 AM, Lawrence >>> D'Oliveiro wrote: In message , Tim Golden wrote: > The difficulty here is knowing where to put s

Re: A Bug By Any Other Name ...

2009-07-06 Thread Daniel Fetchinson
>> Yes, there are plenty of languages other than Java and C, but the >> influence of C is admittedly huge in Python. Why do you think loops >> are called "for", conditionals "if" or "while", functions return via >> "return", loops terminate via "break" and keep going via "continue" >> and why is co

Re: A Bug By Any Other Name ...

2009-07-06 Thread Steven D'Aprano
On Tue, 07 Jul 2009 04:51:51 +, Lie Ryan wrote: > Chris Rebert wrote: >> On Mon, Jul 6, 2009 at 1:29 AM, Lawrence >> D'Oliveiro wrote: >>> In message , Tim >>> Golden wrote: >>> The difficulty here is knowing where to put such a warning. You obviously can't put it against the "++" op

Re: A Bug By Any Other Name ...

2009-07-06 Thread Lie Ryan
Chris Rebert wrote: > On Mon, Jul 6, 2009 at 1:29 AM, Lawrence > D'Oliveiro wrote: >> In message , Tim Golden >> wrote: >> >>> The difficulty here is knowing where to put such a warning. >>> You obviously can't put it against the "++" operator as such >>> because... there isn't one. >> This bug is

Re: A Bug By Any Other Name ...

2009-07-06 Thread Daniel Fetchinson
I wonder how many people have been tripped up by the fact that ++n and --n fail silently for numeric-valued n. >>> >>> What do you mean, "fail silently"? They do exactly what you should >>> expect: >> ++5 # positive of a positive number is p

Re: A Bug By Any Other Name ...

2009-07-06 Thread Lawrence D'Oliveiro
In message , Terry Reedy wrote: > ... it is C, not Python, that is out of step with standard usage in math > and most languages ... And it is C that introduced "==" for equality, versus "=" for assignment, which Python slavishly followed instead of keeping "=" with its mathematical meaning and

Re: Re: A Bug By Any Other Name ...

2009-07-06 Thread Rhodri James
On Mon, 06 Jul 2009 17:54:35 +0100, Dave Angel wrote: Rhodri James wrote: Indeed, arguably it's a bug for C compilers to fail to find the valid parsing of "++5" as "+(+5)". All I can say is that I've never even accidentally typed that in twenty years of C programming. But the C language spec

Re: A Bug By Any Other Name ...

2009-07-06 Thread Terry Reedy
Mark Dickinson wrote: On Jul 6, 3:32 am, Lawrence D'Oliveiro wrote: I wonder how many people have been tripped up by the fact that ++n and --n fail silently for numeric-valued n. Rather few, it seems. Recent python-ideas discussion on this subject: http://mail.python.org/piperm

Re: A Bug By Any Other Name ...

2009-07-06 Thread Pablo Torres N.
On Mon, Jul 6, 2009 at 07:12, Hendrik van Rooyen wrote: > "Terry Reedy" wrote: > >> Gabriel Genellina wrote: >> > >> > In this case, a note in the documentation warning about the potential >> > confusion would be fine. >> >> How would that help someone who does not read the doc? > > It obviously w

Re: Re: A Bug By Any Other Name ...

2009-07-06 Thread Dave Angel
Rhodri James wrote: On Mon, 06 Jul 2009 10:58:21 +0100, Steven D'Aprano wrote: On Mon, 06 Jul 2009 02:19:51 -0300, Gabriel Genellina wrote: En Mon, 06 Jul 2009 00:28:43 -0300, Steven D'Aprano escribió: On Mon, 06 Jul 2009 14:32:46 +1200, Lawrence D'Oliveiro wrote: I wonder how many peo

Re: A Bug By Any Other Name ...

2009-07-06 Thread Rhodri James
On Mon, 06 Jul 2009 10:58:21 +0100, Steven D'Aprano wrote: On Mon, 06 Jul 2009 02:19:51 -0300, Gabriel Genellina wrote: En Mon, 06 Jul 2009 00:28:43 -0300, Steven D'Aprano escribió: On Mon, 06 Jul 2009 14:32:46 +1200, Lawrence D'Oliveiro wrote: I wonder how many people have been tripped

Re: A Bug By Any Other Name ...

2009-07-06 Thread Mark Dickinson
On Jul 6, 3:32 am, Lawrence D'Oliveiro wrote: > I wonder how many people have been tripped up by the fact that > >     ++n > > and > >     --n > > fail silently for numeric-valued n. Recent python-ideas discussion on this subject: http://mail.python.org/pipermail/python-ideas/2009-March/003741.h

Re: A Bug By Any Other Name ...

2009-07-06 Thread pdpi
On Jul 6, 1:12 pm, "Hendrik van Rooyen" wrote: > "Terry Reedy" wrote: > > Gabriel Genellina wrote: > > > > In this case, a note in the documentation warning about the potential > > > confusion would be fine. > > > How would that help someone who does not read the doc? > > It obviously won't. > >

Re: A Bug By Any Other Name ...

2009-07-06 Thread Hendrik van Rooyen
"Terry Reedy" wrote: > Gabriel Genellina wrote: > > > > In this case, a note in the documentation warning about the potential > > confusion would be fine. > > How would that help someone who does not read the doc? It obviously won't. All it will do, is that it will enable people on this group

Re: A Bug By Any Other Name ...

2009-07-06 Thread Steven D'Aprano
On Mon, 06 Jul 2009 02:19:51 -0300, Gabriel Genellina wrote: > En Mon, 06 Jul 2009 00:28:43 -0300, Steven D'Aprano > escribió: >> On Mon, 06 Jul 2009 14:32:46 +1200, Lawrence D'Oliveiro wrote: >> >>> I wonder how many people have been tripped up by the fact that >>> >>> ++n >>> >>> and >>> >>

Re: A Bug By Any Other Name ...

2009-07-06 Thread Terry Reedy
Gabriel Genellina wrote: In this case, a note in the documentation warning about the potential confusion would be fine. How would that help someone who does not read the doc? -- http://mail.python.org/mailman/listinfo/python-list

Re: A Bug By Any Other Name ...

2009-07-06 Thread John Machin
On Jul 6, 12:32 pm, Lawrence D'Oliveiro wrote: > I wonder how many people have been tripped up by the fact that > >     ++n > > and > >     --n > > fail silently for numeric-valued n. What fail? In Python, ++n and --n are fatuous expressions which SUCCEED silently except for rare circiumstances e

Re: A Bug By Any Other Name ...

2009-07-06 Thread alex23
On Jul 6, 5:56 pm, Tim Golden wrote: > Gabriel Genellina wrote: > > In this case, a note in the documentation warning about the potential > > confusion would be fine. > > The difficulty here is knowing where to put such a warning. > You obviously can't put it against the "++" operator as such > be

Re: A Bug By Any Other Name ...

2009-07-06 Thread Chris Rebert
On Mon, Jul 6, 2009 at 1:29 AM, Lawrence D'Oliveiro wrote: > In message , Tim Golden > wrote: > >> The difficulty here is knowing where to put such a warning. >> You obviously can't put it against the "++" operator as such >> because... there isn't one. > > This bug is an epiphenomenon. :) Well, l

Re: A Bug By Any Other Name ...

2009-07-06 Thread Lawrence D'Oliveiro
In message , Tim Golden wrote: > The difficulty here is knowing where to put such a warning. > You obviously can't put it against the "++" operator as such > because... there isn't one. This bug is an epiphenomenon. :) -- http://mail.python.org/mailman/listinfo/python-list

Re: A Bug By Any Other Name ...

2009-07-06 Thread Tim Golden
Gabriel Genellina wrote: [... re confusion over ++n etc ...] In this case, a note in the documentation warning about the potential confusion would be fine. The difficulty here is knowing where to put such a warning. You obviously can't put it against the "++" operator as such because... there

Re: A Bug By Any Other Name ...

2009-07-06 Thread Gabriel Genellina
En Mon, 06 Jul 2009 03:33:36 -0300, Gary Herron escribió: Gabriel Genellina wrote: En Mon, 06 Jul 2009 00:28:43 -0300, Steven D'Aprano escribió: On Mon, 06 Jul 2009 14:32:46 +1200, Lawrence D'Oliveiro wrote: I wonder how many people have been tripped up by the fact that ++n and

Re: A Bug By Any Other Name ...

2009-07-05 Thread Gary Herron
Gabriel Genellina wrote: En Mon, 06 Jul 2009 00:28:43 -0300, Steven D'Aprano escribió: On Mon, 06 Jul 2009 14:32:46 +1200, Lawrence D'Oliveiro wrote: I wonder how many people have been tripped up by the fact that ++n and --n fail silently for numeric-valued n. What do you mean,

Re: A Bug By Any Other Name ...

2009-07-05 Thread Gabriel Genellina
En Mon, 06 Jul 2009 00:28:43 -0300, Steven D'Aprano escribió: On Mon, 06 Jul 2009 14:32:46 +1200, Lawrence D'Oliveiro wrote: I wonder how many people have been tripped up by the fact that ++n and --n fail silently for numeric-valued n. What do you mean, "fail silently"? They do

Re: A Bug By Any Other Name ...

2009-07-05 Thread Steven D'Aprano
On Mon, 06 Jul 2009 14:32:46 +1200, Lawrence D'Oliveiro wrote: > I wonder how many people have been tripped up by the fact that > > ++n > > and > > --n > > fail silently for numeric-valued n. What do you mean, "fail silently"? They do exactly what you should expect: >>> ++5 # posit

Re: A Bug By Any Other Name ...

2009-07-05 Thread Chris Rebert
On Sun, Jul 5, 2009 at 7:32 PM, Lawrence D'Oliveiro wrote: > I wonder how many people have been tripped up by the fact that > >    ++n > > and > >    --n > > fail silently for numeric-valued n. Given that C-style for-loops are relatively infrequent in Python and are usually written using range() w