Re: [Tutor] Testing for empty list

2009-10-18 Thread शंतनू
On 19-Oct-09, at 7:11 AM, vince spicer wrote: On Sun, Oct 18, 2009 at 7:29 PM, Wayne wrote: Hi, I think I recall seeing this here, but I wanted to make sure I'm correct. Is the best way to test for an empty list just test for the truth value? I.e. mylist = [1,2,3] while mylist: p

Re: [Tutor] Testing for empty list

2009-10-18 Thread vince spicer
On Sun, Oct 18, 2009 at 7:29 PM, Wayne wrote: > Hi, I think I recall seeing this here, but I wanted to make sure I'm > correct. > Is the best way to test for an empty list just test for the truth value? > I.e. > > mylist = [1,2,3] > > while mylist: >print mylist.pop() > > Thanks, > Wayne > >

[Tutor] Testing for empty list

2009-10-18 Thread Wayne
Hi, I think I recall seeing this here, but I wanted to make sure I'm correct. Is the best way to test for an empty list just test for the truth value? I.e. mylist = [1,2,3] while mylist: print mylist.pop() Thanks, Wayne -- To be considered stupid and to be told so is more painful than being

Re: [Tutor] CSV question for getting data from a text file

2009-10-18 Thread Alan Gauld
"Ara Kooser" wrote testreader = csv.reader(open(filein)) for row in testreader: print(row) The output looks like this: [] ['Distribution of species'] [] ['\t Log Log Log '] ['\t

[Tutor] CSV question for getting data from a text file

2009-10-18 Thread Ara Kooser
Hello all, I fell off the python programming wagon for awhile and I am quite rusty. I a text file that looks like this *a bunch of stuff above* O(-2)/O(0) 12.5731 0.7181 Distribution of species

Re: [Tutor] Any one got any idea

2009-10-18 Thread David
nitin chandra wrote: On Mon, Oct 19, 2009 at 1:58 AM, nitin chandra wrote: Hello Everyone, i am compiling Python 2.6.2 from source and have successfully been able to cross at least that is what i am thinking . ./configure and make but i am facing a peculiar problem in installing

Re: [Tutor] introspecting an object for method's name?

2009-10-18 Thread Alan Gauld
"Serdar Tumgoren" wrote Is there a way to dynamically grab the name of the method? E.g., "get_name" in the above class. There may be more direct or easier ways but the traceback moduile lets you inspect the call stack to see what the current method or function is. Thats how Python produc

Re: [Tutor] Any one got any idea

2009-10-18 Thread nitin chandra
On Mon, Oct 19, 2009 at 1:58 AM, nitin chandra wrote: > Hello Everyone, > > i am compiling Python 2.6.2 from source and have successfully been > able to cross at least that is what i am thinking . > ./configure and make but i am facing a peculiar problem in > installing it this time.

[Tutor] introspecting an object for method's name?

2009-10-18 Thread Serdar Tumgoren
Hi everyone, I'm trying to create a generic logging function, and I'm able to get at the name of the module and class using the built-in attributes __module__, __class__, and __name__. But I wasn't sure how to also grab the name of the function or method, so that when an error occurs, I can log th

[Tutor] Any one got any idea

2009-10-18 Thread nitin chandra
Hello Everyone, i am compiling Python 2.6.2 from source and have successfully been able to cross at least that is what i am thinking . ./configure and make but i am facing a peculiar problem in installing it this time. (This is the second time i am installing on the same system with