Re: [Tutor] subprocess.Popen.communicate()[]

2006-12-28 Thread Isaac
> "Isaac" > > I have the following in my PYTHONSTARTUP file > > > > def clear(): > >x = subprocess.Popen("clear").communicate(None)[0] > >return x > > > > Yes, but can't you simplify this to just: > > > import subprocess > def clear(): > subProcess.Popen('clear') > > if all you want to

Re: [Tutor] OT: Python 2.5 (Was Re: Length of longest item in a list, using a list comp)

2006-12-28 Thread wesley chun
> What are the must-have new features? (I could read the what's-new > doc but that tells me about stuff I may not see the value in!) > > What are the features people are actually using regularly and find > an improvement? below is a quick summary of the 2.5 highlights. of these, i like/use the fo

Re: [Tutor] OT: Python 2.5 (Was Re: Length of longest item in a list, using a list comp)

2006-12-28 Thread Terry Carroll
On Thu, 28 Dec 2006, Chris Hengge wrote: > I hope this is related enough for this thread, but I'm curious why people > didn't seem to unanimously jump into 2.5 upon release. I find the Activestate distribution particularly convenient, so I'm awaiting that.

Re: [Tutor] OT: Python 2.5 (Was Re: Length of longest item in a list, using a list comp)

2006-12-28 Thread Chris Hengge
I hope this is related enough for this thread, but I'm curious why people didn't seem to unanimously jump into 2.5 upon release. Python seems very good about holding its backward compatibility vs some other languages I've dealt with like C# that seems to require applications rewritten with every p

[Tutor] OT: Python 2.5 (Was Re: Length of longest item in a list, using a list comp)

2006-12-28 Thread Alan Gauld
"Andreas Kostyrka" <[EMAIL PROTECTED]> wrote >> With versions >= 2.4 you can omit the [] > With 2.5 you can even do stuff like that: I missed the announcement somewhere but 2.5 seems to have been out for a spell now. What are the must-have new features? (I could read the what's-new doc but th

Re: [Tutor] Length of longest item in a list, using a list comp

2006-12-28 Thread Kent Johnson
Andreas Kostyrka wrote: > With 2.5 you can even do stuff like that: > x=[range(5), range(3), range(7)] max(x, key=lambda i: len(i)) > [0, 1, 2, 3, 4, 5, 6] No need for the lambda, just use max(x, key=len) Kent ___ Tutor maillist - Tutor@py

Re: [Tutor] Length of longest item in a list, using a list comp

2006-12-28 Thread Tony Cappellini
Thanks, but I am restricted to using 2.3.4 for now, so longest = max([len(x) for x in ll]) works for me On 12/28/06, Andreas Kostyrka <[EMAIL PROTECTED]> wrote: * Python <[EMAIL PROTECTED]> [061228 20:44]: > On Thu, 2006-12-28 at 11:27 -0800, Tony Cappellini wrote: > > > > > > I want to use

Re: [Tutor] Length of longest item in a list, using a list comp

2006-12-28 Thread Andreas Kostyrka
* Python <[EMAIL PROTECTED]> [061228 20:44]: > On Thu, 2006-12-28 at 11:27 -0800, Tony Cappellini wrote: > > > > > > I want to use a list comp to get the length of the longest string in a > > list, but can't quite get the syntax right. > > > > l1=['abc', 'abcde', 'abcfdtea'] > > > > longest=0 >

Re: [Tutor] Length of longest item in a list, using a list comp

2006-12-28 Thread Python
On Thu, 2006-12-28 at 11:27 -0800, Tony Cappellini wrote: > > > I want to use a list comp to get the length of the longest string in a > list, but can't quite get the syntax right. > > l1=['abc', 'abcde', 'abcfdtea'] > > longest=0 > [x for x in l1 if len(x) > longest] Use max to get the longe

[Tutor] Length of longest item in a list, using a list comp

2006-12-28 Thread Tony Cappellini
I want to use a list comp to get the length of the longest string in a list, but can't quite get the syntax right. l1=['abc', 'abcde', 'abcfdtea'] longest=0 [x for x in l1 if len(x) > longest] The problem is I can't add the true clause to the if statement in a list comp as in if len(x) > longes

Re: [Tutor] Why a global?

2006-12-28 Thread Alan Gauld
"Carlos" <[EMAIL PROTECTED]> wrote > > Sheesh, that solved it, guess that I got to learn OO next. Unles it > is > not related... :-[ The problem you had was about reassigning a name from a module to an object, but it could have been any kind of object - a variable, a function, another module, an

Re: [Tutor] Why a global?

2006-12-28 Thread Carlos
Chris, Sheesh, that solved it, guess that I got to learn OO next. Unles it is not related... :-[ Thanks a lot! Carlos ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Python and rpy

2006-12-28 Thread Geoframer
Hey Kent, Well i've gotten exactly no response on the Rpy-list on both my questions :-(. However i switched to Ubuntu 6.10 today (from WinXP) and to my suprise it does work under linux! :-) RHOME= /usr/lib/R RVERSION= 2.3.1 RVER= 2031 RUSER= /home/geofram Loading Rpy version 2031 .. Done. Creat

Re: [Tutor] subprocess.Popen.communicate()[]

2006-12-28 Thread Alan Gauld
"Isaac" <[EMAIL PROTECTED]> wrote in > I have the following in my PYTHONSTARTUP file > > def clear(): >x = subprocess.Popen("clear").communicate(None)[0] >return x > > Am in correct in my interpretation of the interpreter? Yes, but can't you simplify this to just: import subprocess d

Re: [Tutor] XML-RPC data transfers.

2006-12-28 Thread Alan Gauld
"Chris Hengge" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > I'm trying to figure out how to send data using XML-RPC. Currently > my target > is to send a PIL imagegrab.grab() from one side of the connection to > the > other. Any particular reason to use RPC here? This will like

[Tutor] subprocess.Popen.communicate()[]

2006-12-28 Thread Isaac
Hello tutors! I have the following in my PYTHONSTARTUP file def clear(): x = subprocess.Popen("clear").communicate(None)[0] return x so that when I type: clear() at the prompt, my terminal screen clears and I get only my prompt at the top of the screen. without the index at the end of

[Tutor] XML-RPC data transfers.

2006-12-28 Thread Chris Hengge
I'm trying to figure out how to send data using XML-RPC. Currently my target is to send a PIL imagegrab.grab() from one side of the connection to the other. I've got stuff like numbers and strings going back and forth, so I know my connection is working, but I'm not sure how to send the image. 'S