Re: [Tutor] How to substitute an element of a list asapattern forre.compile()

2005-01-02 Thread Alan Gauld
for x in ['string', 10, True, [1,2,3] ]: ... print '%s' %x ... string 10 True [1, 2, 3] That's cool! I didn't know that. I guess I'm crazy... : ) (We already knew that here.) The difference is in how the formatting details work. For numbers the formatting digits

Re: [Tutor] doctest

2005-01-02 Thread Kent Johnson
Jacob S. wrote: Even so, doctest doesn't seem to recognize the module level docstring. It will run the test inside the functions, but it says there isn't a test on the module level. I put the docstring just like in the example at the link you provided... Please post the code for the module you are

Re: [Tutor] doctest

2005-01-02 Thread Kent Johnson
Alan Gauld wrote: Also, anything I can do... Presently, since I'm running windows xp, I would have to hunt for the command prompt and type in the command Start-Run Type cmd, Hit OK :-) Or drag the icon from accessories into the start menu or to the desktop. Or drag the icon to the left side of

[Tutor] simple list query

2005-01-02 Thread Dave S
OK simple query, I have a list consisting of about 250 items, I need to know if a particular item is in the list. I know this is better suited to a dictionary but thats not the way it ended up ;-) I could do a for loop to scan the list compare each one, but I have a suspission that there is

Re: [Tutor] simple list query

2005-01-02 Thread Bill Kranec
You might want to try: x in list this will return true if, for example, list = [x,y,z,w], false if list = [y,y,y,y] Bill Dave S wrote: OK simple query, I have a list consisting of about 250 items, I need to know if a particular item is in the list. I know this is better suited to a

Re: [Tutor] simple list query

2005-01-02 Thread Patrick Hall
Hi Dave, I have a list consisting of about 250 items, I need to know if a particular item is in the list. I know this is better suited to a dictionary but thats not the way it ended up ;-) I could do a for loop to scan the list compare each one, but I have a suspission that there is a

[Tutor] Am I storeing up problems ?

2005-01-02 Thread Dave S
Hi there again, My matrix 'self.data' consists of a list of 110 items, each item is a dictionary of 250 keys, each key holds two lists, one of four items, one of 12 items. I needed to copy this matrix to 'self.old_data', so I have been using .deepcopy(), which works OK but is SLOW (12+

[Tutor] Basic question - How to use a class from a file?

2005-01-02 Thread Bernard Lebel
Hello, An easy one to start the year. Trying to write my first class, already running into problems after 3 lines! :-( So have this little class: class rt: def walk(self): print 'yeah' So if I write this in the Python shell, instantiate rt and call walk(), I get the

Re: [Tutor] Basic question - How to use a class from a file?

2005-01-02 Thread tanja pislar
hi Bernard, you have to specify the module as well: let's say your module is called rtModule.py, then in your case you'd do: import rtModule testClass = rtModule.rt() testClass.walk() or: from rtModule import rt testClass = rt() testClass.walk() regards, tanja On Sun, 02 Jan 2005 17:43:07

[Tutor] A not-so-basic question...

2005-01-02 Thread Patric Michael
Hi folks... I was thinking about this the other day while prepping to write up another CGI thing. It occurred to me to wonder how other folks prepare an app, script, whatever. So the question is, and I am not looking for a right answer here. (I doubt ther eis one, to be honest.) How do you

Re: [Tutor] simple list query

2005-01-02 Thread Alan Gauld
I have a list consisting of about 250 items, I need to know if a particular item is in the list. I know this is better suited to a dictionary but thats not the way it ended up ;-) I could do a for loop to scan the list compare each one, but I have a suspission that there is a better way ?

[Tutor] My 2nd ever .py script [XML, makedirs, copytree]

2005-01-02 Thread Rafal Kaniewski
This is my second script (if you don't include the last time I programmed (20 years ago...) it's a nasty hack but it works... --- ?xml version=1.0 encoding=UTF-8 ? - !-- This grammar has been deprecated - use FMPXMLRESULT