Re: Python statements not forcing whitespace is messy?

2007-09-16 Thread Dustan
On Sep 15, 5:11 pm, James Stroud [EMAIL PROTECTED] wrote:
 Steve Holden wrote:
  I don't know why you have a bug up your ass about it, as the
  Americans say.

 I think most Americans say wild hare up your ass. We do not, in fact,
 say wild hair up your ass. Many of us can testify that a hair up one's
 ass would be nothing terribly unusual and would go completely unnoticed
 under most circumstances.

 Also, some Americans erroneously say hair's breath, and others think
 they mean hare's breath (which might be tiny, but diffuses quickly to
 theoretically infinite volume). In reality, however, they mean hair's
 breadth--which is quite small indeed! For instance, a hair's breadth is
 far smaller than a hare's breath (even at the exact moment of respiration).

 James

Funny... I have never heard any of those expressions. I guess I need
to get out more.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python statements not forcing whitespace is messy?

2007-09-16 Thread Peter Decker
On 9/15/07, Steve Holden [EMAIL PROTECTED] wrote:
 John Machin wrote:
  On 16/09/2007 8:11 AM, James Stroud wrote:
  Steve Holden wrote:
  I don't know why you have a bug up your ass about it, as the
  Americans say.
  I think most Americans say wild hare up your ass.
 

 I guess I got the metaphor wrong?

Maybe it's a Southern US thing. I've always heard bug used; somehow
it doesn't seem that a wild hare would fit!

-- 

# p.d.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python statements not forcing whitespace is messy?

2007-09-16 Thread James Stroud
Peter Decker wrote:
 On 9/15/07, Steve Holden [EMAIL PROTECTED] wrote:
 John Machin wrote:
 On 16/09/2007 8:11 AM, James Stroud wrote:
 Steve Holden wrote:
 I don't know why you have a bug up your ass about it, as the
 Americans say.
 I think most Americans say wild hare up your ass.
 
 I guess I got the metaphor wrong?
 
 Maybe it's a Southern US thing. I've always heard bug used; somehow
 it doesn't seem that a wild hare would fit!
 

We say wild hare down in Texas. I think I've heard bug before, but I 
wanted an excuse to vent about the hair v. hare issue in some of these 
American idioms. I guess I have a insert idiom here about it.

James
-- 
http://mail.python.org/mailman/listinfo/python-list


Python statements not forcing whitespace is messy?

2007-09-15 Thread buffi
Am I the only one that thinks that python statements should force
whitespace before and after them?

Right now this is not enforced and for an example these statements are
valid

printhello
fooifbarelsefoobar
for(x,y)in[(1,2),(3,4)]:print(x,y)
[(y)for(x,y)in[(foo,2),(bar,4)]iffooin(x)]

...and so on.

I know that writing code like this really shouldn't be done but
wouldn't it be a good idea to enforce the use of whitespace around
statements?

(I wrote a short blog post about this here http://blog.buffis.com/?p=55
but thought I would post here as well to see what other developers
think)
- Björn Kempén

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python statements not forcing whitespace is messy?

2007-09-15 Thread James Stroud
buffi wrote:
 Am I the only one that thinks that python statements should force
 whitespace before and after them?
 
 Right now this is not enforced and for an example these statements are
 valid
 
 printhello
 fooifbarelsefoobar
 for(x,y)in[(1,2),(3,4)]:print(x,y)
 [(y)for(x,y)in[(foo,2),(bar,4)]iffooin(x)]
 
 ...and so on.
 
 I know that writing code like this really shouldn't be done but
 wouldn't it be a good idea to enforce the use of whitespace around
 statements?
 
 (I wrote a short blog post about this here http://blog.buffis.com/?p=55
 but thought I would post here as well to see what other developers
 think)
 - Björn Kempén
 

You may have a point--but on the other hand, this may be purposefully 
allowed help to recruit perl programmers.

James
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python statements not forcing whitespace is messy?

2007-09-15 Thread J. Cliff Dyer
buffi wrote:
 Am I the only one that thinks that python statements should force
 whitespace before and after them?

 Right now this is not enforced and for an example these statements are
 valid

 printhello
 fooifbarelsefoobar
 for(x,y)in[(1,2),(3,4)]:print(x,y)
 [(y)for(x,y)in[(foo,2),(bar,4)]iffooin(x)]

 ...and so on.


On the other hand, this is just as bad:

[ ( y ) for ( x , y ) in [ ( foo , 2 ) , ( bar , 4 ) ] if foo in (
x ) ]


And I'd hate to have to remember all of the rules for what can go
together and what can't, especially when it comes time to debug.  No.
I don't think it should be forced, but maybe put it in PEP8 or PEP3008.

Also, the only thing I find thoroughly disagreeable in all of that
mess, is the run-ins involving  characters.  The rest are at least
clear at a glance what belongs where.

Also, would you require the following?

my_function (swallow='European')

Because that is just an awful use of whitespace.

Cheers,
Cliff



-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python statements not forcing whitespace is messy?

2007-09-15 Thread Eduardo O. Padoan
On 9/15/07, J. Cliff Dyer [EMAIL PROTECTED] wrote:
 And I'd hate to have to remember all of the rules for what can go
 together and what can't, especially when it comes time to debug.  No.
 I don't think it should be forced, but maybe put it in PEP8 or PEP3008.

It is: see Whitespace in Expressions and Statements in PEP 8.


-- 
http://www.advogato.org/person/eopadoan/
Bookmarks: http://del.icio.us/edcrypt
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python statements not forcing whitespace is messy?

2007-09-15 Thread buffi
On Sep 15, 10:11 pm, J. Cliff Dyer [EMAIL PROTECTED] wrote:
 buffi wrote:
  Am I the only one that thinks that python statements should force
  whitespace before and after them?

  Right now this is not enforced and for an example these statements are
  valid

  printhello
  fooifbarelsefoobar
  for(x,y)in[(1,2),(3,4)]:print(x,y)
  [(y)for(x,y)in[(foo,2),(bar,4)]iffooin(x)]

  ...and so on.

 On the other hand, this is just as bad:

 [ ( y ) for ( x , y ) in [ ( foo , 2 ) , ( bar , 4 ) ] if foo in (
 x ) ]

 And I'd hate to have to remember all of the rules for what can go
 together and what can't, especially when it comes time to debug.  No.
 I don't think it should be forced, but maybe put it in PEP8 or PEP3008.

 Also, the only thing I find thoroughly disagreeable in all of that
 mess, is the run-ins involving  characters.  The rest are at least
 clear at a glance what belongs where.

 Also, would you require the following?

 my_function (swallow='European')

 Because that is just an awful use of whitespace.

 Cheers,
 Cliff

I believe that having whitespace around the builtin statements, and
having whitespace around everything is pretty different.

There would be no downside whatsoever to enforcing this, except for
backwards incompatibility (which is a rather huge downside but well...
py3k is gonna break everything anyways). There obviously shouldnt be
any limit to the maximum amount of whitespace used around statements
(due to formatting and so on), but allowing stuff like printhello is
just horrible.

- Björn Kempén

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python statements not forcing whitespace is messy?

2007-09-15 Thread Steve Holden
buffi wrote:
 On Sep 15, 10:11 pm, J. Cliff Dyer [EMAIL PROTECTED] wrote:
 buffi wrote:
 Am I the only one that thinks that python statements should force
 whitespace before and after them?
 Right now this is not enforced and for an example these statements are
 valid
 printhello
 fooifbarelsefoobar
 for(x,y)in[(1,2),(3,4)]:print(x,y)
 [(y)for(x,y)in[(foo,2),(bar,4)]iffooin(x)]
 ...and so on.
 On the other hand, this is just as bad:

 [ ( y ) for ( x , y ) in [ ( foo , 2 ) , ( bar , 4 ) ] if foo in (
 x ) ]

 And I'd hate to have to remember all of the rules for what can go
 together and what can't, especially when it comes time to debug.  No.
 I don't think it should be forced, but maybe put it in PEP8 or PEP3008.

 Also, the only thing I find thoroughly disagreeable in all of that
 mess, is the run-ins involving  characters.  The rest are at least
 clear at a glance what belongs where.

 Also, would you require the following?

 my_function (swallow='European')

 Because that is just an awful use of whitespace.

 Cheers,
 Cliff
 
 I believe that having whitespace around the builtin statements, and
 having whitespace around everything is pretty different.
 
 There would be no downside whatsoever to enforcing this, except for
 backwards incompatibility (which is a rather huge downside but well...
 py3k is gonna break everything anyways). There obviously shouldnt be
 any limit to the maximum amount of whitespace used around statements
 (due to formatting and so on), but allowing stuff like printhello is
 just horrible.
 
If you don't like it then don't write it. I've been reading this group 
on and off for about ten years and I believe your email is the first to 
point out that this is possible. Clearly it isn't something that happens 
a lot, and I don't know why you have a bug up your ass about it, as the 
Americans say.

The Python philosophy is to be permissive, and to expect individual 
users to write readable Python. Since they obviously do (one message in 
ten years providing a counter-example) I think you are wasting your time 
and energy on this.

regards
  Steve
-- 
Steve Holden+1 571 484 6266   +1 800 494 3119
Holden Web LLC/Ltd   http://www.holdenweb.com
Skype: holdenweb  http://del.icio.us/steve.holden

Sorry, the dog ate my .sigline

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python statements not forcing whitespace is messy?

2007-09-15 Thread buffi
On Sep 15, 11:49 pm, Steve Holden [EMAIL PROTECTED] wrote:
 buffi wrote:
  On Sep 15, 10:11 pm, J. Cliff Dyer [EMAIL PROTECTED] wrote:
  buffi wrote:
  Am I the only one that thinks that python statements should force
  whitespace before and after them?
  Right now this is not enforced and for an example these statements are
  valid
  printhello
  fooifbarelsefoobar
  for(x,y)in[(1,2),(3,4)]:print(x,y)
  [(y)for(x,y)in[(foo,2),(bar,4)]iffooin(x)]
  ...and so on.
  On the other hand, this is just as bad:

  [ ( y ) for ( x , y ) in [ ( foo , 2 ) , ( bar , 4 ) ] if foo in (
  x ) ]

  And I'd hate to have to remember all of the rules for what can go
  together and what can't, especially when it comes time to debug.  No.
  I don't think it should be forced, but maybe put it in PEP8 or PEP3008.

  Also, the only thing I find thoroughly disagreeable in all of that
  mess, is the run-ins involving  characters.  The rest are at least
  clear at a glance what belongs where.

  Also, would you require the following?

  my_function (swallow='European')

  Because that is just an awful use of whitespace.

  Cheers,
  Cliff

  I believe that having whitespace around the builtin statements, and
  having whitespace around everything is pretty different.

  There would be no downside whatsoever to enforcing this, except for
  backwards incompatibility (which is a rather huge downside but well...
  py3k is gonna break everything anyways). There obviously shouldnt be
  any limit to the maximum amount of whitespace used around statements
  (due to formatting and so on), but allowing stuff like printhello is
  just horrible.

 If you don't like it then don't write it. I've been reading this group
 on and off for about ten years and I believe your email is the first to
 point out that this is possible. Clearly it isn't something that happens
 a lot, and I don't know why you have a bug up your ass about it, as the
 Americans say.

 The Python philosophy is to be permissive, and to expect individual
 users to write readable Python. Since they obviously do (one message in
 ten years providing a counter-example) I think you are wasting your time
 and energy on this.

 regards
   Steve
 --
 Steve Holden+1 571 484 6266   +1 800 494 3119
 Holden Web LLC/Ltd  http://www.holdenweb.com
 Skype: holdenweb  http://del.icio.us/steve.holden

 Sorry, the dog ate my .sigline

I actually found out about this myself while grading student labs. I
myself didn't even know that you could write statements like this
until then, but since some students does it that means that there
should be other people out there as well that does it.

And I can't say that I agree about The Python philosophy being
permissive, and to expect individual users to write readable Python.
Python enforces proper indentation which I think is a great idea since
I'm used to reading horribly indented code by others. I would love to
see this extended to enforce proper whitespacing for statements.

There should be one-and preferably only one-obvious way to do it. is
a phrase that is usually considered pythonic, and I think that it
should also apply a bit when it comes to coding conventions.

- Björn Kempén

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python statements not forcing whitespace is messy?

2007-09-15 Thread James Stroud
Steve Holden wrote:
 I don't know why you have a bug up your ass about it, as the
 Americans say.

I think most Americans say wild hare up your ass. We do not, in fact, 
say wild hair up your ass. Many of us can testify that a hair up one's 
ass would be nothing terribly unusual and would go completely unnoticed 
under most circumstances.

Also, some Americans erroneously say hair's breath, and others think 
they mean hare's breath (which might be tiny, but diffuses quickly to 
theoretically infinite volume). In reality, however, they mean hair's 
breadth--which is quite small indeed! For instance, a hair's breadth is 
far smaller than a hare's breath (even at the exact moment of respiration).

James
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python statements not forcing whitespace is messy?

2007-09-15 Thread John Machin
On 16/09/2007 8:11 AM, James Stroud wrote:
 Steve Holden wrote:
 I don't know why you have a bug up your ass about it, as the
 Americans say.
 
 I think most Americans say wild hare up your ass.

The essence of Steve's point appears to be that the OP has ridden into 
town to preach a misguided crusade against the heretofore-unknown 
non-spacing heretics.  It also seems to be alleged that at some stage, 
the OP's donkey has been severely molested by some malevolent fauna; I 
am having difficulty understanding the connection between the two 
themes, and which is cause and which is effect. Enlightenment, please.

-- 
http://mail.python.org/mailman/listinfo/python-list


RE: Python statements not forcing whitespace is messy?

2007-09-15 Thread Ryan Ginstrom
 On Behalf Of J. Cliff Dyer
 On the other hand, this is just as bad:
 
 [ ( y ) for ( x , y ) in [ ( foo , 2 ) , ( bar , 4 ) ] if 
 foo in ( x ) ]

I think that's allowed in order to recruit C/C++ programmers.

Regards,
Ryan Ginstrom

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python statements not forcing whitespace is messy?

2007-09-15 Thread Steven D'Aprano
On Sun, 16 Sep 2007 09:14:57 +0900, Ryan Ginstrom wrote:

 On Behalf Of J. Cliff Dyer
 On the other hand, this is just as bad:
 
 [ ( y ) for ( x , y ) in [ ( foo , 2 ) , ( bar , 4 ) ] if foo in
 ( x ) ]
 
 I think that's allowed in order to recruit C/C++ programmers.

Heh :)

In all seriousness, sometimes, in an extremely crowded and busy 
expression, adding a little extra whitespace to emphasize the boundaries 
between sub-expressions is a good thing. And let's not forget that we can 
do this:

 complex_expression = (
... 2*x + # double the whatzit
... 1.78**(c*3-1) +   # see chapter 2 of Martelli, 2008
... sin(radians(80))  # angle between the foo and the bar
... )



-- 
Steven.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python statements not forcing whitespace is messy?

2007-09-15 Thread Steve Holden
John Machin wrote:
 On 16/09/2007 8:11 AM, James Stroud wrote:
 Steve Holden wrote:
 I don't know why you have a bug up your ass about it, as the
 Americans say.
 I think most Americans say wild hare up your ass.
 
 The essence of Steve's point appears to be that the OP has ridden into 
 town to preach a misguided crusade against the heretofore-unknown 
 non-spacing heretics.  It also seems to be alleged that at some stage, 
 the OP's donkey has been severely molested by some malevolent fauna; I 
 am having difficulty understanding the connection between the two 
 themes, and which is cause and which is effect. Enlightenment, please.
 
I guess I got the metaphor wrong?

Eradicate the ten fetters of Buddhism and you will attain enlightenment.

regards
  Steve
-- 
Steve Holden+1 571 484 6266   +1 800 494 3119
Holden Web LLC/Ltd   http://www.holdenweb.com
Skype: holdenweb  http://del.icio.us/steve.holden

Sorry, the dog ate my .sigline

-- 
http://mail.python.org/mailman/listinfo/python-list