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-li

Re: string questions

2007-09-15 Thread J. Cliff Dyer
Marc 'BlackJack' Rintsch wrote: > But please don't use the functions in `string` that are also available as > methods on strings. Those functions are deprecated. > > Meaning (for newbie clarification): instead of string.upper(s2), just do s2.upper(). For more detail, see the docs. -- http

Re: how to join array of integers?

2007-09-15 Thread Steven D'Aprano
On Sat, 15 Sep 2007 16:07:07 +, Grant Edwards wrote: > It's nice people have invented so many ways to spell the builting "map" > ;) > ",".join(map(str,[1,2,3])) > '1,2,3' The oldest solution, and if not the fastest, at least neck-and-neck with the list comprehension. >>> timeit.Time

Re: Needless copying in iterations?

2007-09-15 Thread Steven D'Aprano
On Sun, 16 Sep 2007 00:05:58 +, Marc 'BlackJack' Rintsch wrote: > On Sat, 15 Sep 2007 14:58:15 -0700, James Stroud wrote: > >> I was staring at a segment of code that looked like this today: >> >> for something in stuff[x:y]: >> whatever(something) >> >> and was wondering if the c

Re: Latest software here!!!!!

2007-09-15 Thread pixellee
On 9 16 , 2 51 , [EMAIL PROTECTED] wrote: > http://freesoftwareupgrades.blogspot.com/ what -- 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

Re: How to avoid overflow errors

2007-09-15 Thread Steven D'Aprano
On Sat, 15 Sep 2007 02:45:10 -0700, James Stroud wrote: > Steven D'Aprano wrote: >> On Fri, 14 Sep 2007 18:19:45 -0700, James Stroud wrote: >> How do I subclass int and/or long so that my class also auto-converts only when needed? >>> Use __new__. >> >> The disadvantage of that is

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 in

thanks everyone for your replies!

2007-09-15 Thread Shawn Minisall
:) -- http://mail.python.org/mailman/listinfo/python-list

Python & Blend or Maya

2007-09-15 Thread pixellee
Anybody introdcing something on the subject? -- http://mail.python.org/mailman/listinfo/python-list

Re: List append

2007-09-15 Thread Rob E
On Sat, 15 Sep 2007 03:25:27 +, mouseit wrote: > I'm trying to add an element to a list which is a property of an > object, stored in an array. When I append to one element, all of the > lists are appended! > > Example Code: > > class Test: > array = [] > > myTests = [Test() , Test() ,

Re: how to join array of integers?

2007-09-15 Thread Robert Kern
Grant Edwards wrote: > On 2007-09-15, Robert Kern <[EMAIL PROTECTED]> wrote: >> Grant Edwards wrote: >>> On 2007-09-15, Erik Jones <[EMAIL PROTECTED]> wrote: >>> >> print ''.join([str(i) for i in [1,2,3]]) > It's better to use generator comprehension instead of LC: > > ",".join(str(

Re: List append

2007-09-15 Thread Steve Holden
Rob E wrote: > On Sat, 15 Sep 2007 03:25:27 +, mouseit wrote: > >> I'm trying to add an element to a list which is a property of an >> object, stored in an array. When I append to one element, all of the >> lists are appended! >> >> Example Code: >> >> class Test: >> array = [] >> >> myTes

Re: Needless copying in iterations?

2007-09-15 Thread Ben Finney
Steven D'Aprano <[EMAIL PROTECTED]> writes: > In *general* the compiler can't tell, but in specific cases it > could. A (hypothetical) optimizing compiler would tell the > difference between: > > for item in alist[1:5]: > print item # no possible side-effects The 'print' statement converts t

Re: subclass of integers

2007-09-15 Thread Roberto Bonvallet
On Sep 14, 10:30 am, Mark Morss <[EMAIL PROTECTED]> wrote: > I would like to construct a class that includes both the integers and > None. I desire that if x and y are elements of this class, and both > are integers, then arithmetic operations between them, such as x+y, > return the same result as

Un(der)documented bits of cgi.py

2007-09-15 Thread Bob Kline
I'm trying to detect and intelligently deal with problems created when a user of a Python CGI page uploads a file and then gets impatient and clicks on some other button or the browser's cancel button (or even closes the page). If the file is large enough, and the user is impatient enough, thi

Re: Needless copying in iterations?

2007-09-15 Thread Marc 'BlackJack' Rintsch
On Sun, 16 Sep 2007 00:40:13 +, Steven D'Aprano wrote: > On Sun, 16 Sep 2007 00:05:58 +, Marc 'BlackJack' Rintsch wrote: > > In *general* the compiler can't tell, but in specific cases it could. A > (hypothetical) optimizing compiler would tell the difference between: > > > for item in

Re: Just bought Python in a Nutshell

2007-09-15 Thread Alex Martelli
7stud <[EMAIL PROTECTED]> wrote: > Used copies of computer books for out of date editions are always > cheap. "Python in a Nutshell (2nd ed)" is a reference book with a > frustratingly poor index--go figure. It also contains errors not > posted in the errata. You can always enter errata at

<    1   2