Re: [Tutor] Strange Appending

2004-12-03 Thread Anna Ravenscroft
mdcooper wrote: Hello, I am trying to append a list to another list, but everytime I do, the new parent list has a new child list, but all the other lists have become the same as the new child list. Code: self._f.write(str(self.residue.atoms[int(t[0])-1].element) + ' ') for m in t:

Re: [Tutor] O.T.

2004-12-30 Thread Anna Ravenscroft
Jacob S. wrote: I hate to sound weird... Too late. ;-) Join the crowd! Anna Martelli Ravenscroft 42, 2 children (13 and 11) live with their dad Married this July to the martelli-bot (we read The Zen of Python at our wedding!). We currently live in Bologna, Italy. Started learning Python in 2002 b

Re: [Tutor] how to get the return value?

2006-03-04 Thread Anna Ravenscroft
On 3/4/06, Ingo <[EMAIL PROTECTED]> wrote: To make a time lapse video I've been playing with the sched module.There is one problem I run into, in the code below, how do I get thereturned value t from printtime into main?import timefrom sched import scheduler class time_lapse(scheduler):def time

Re: [Tutor] how to get the return value?

2006-03-05 Thread Anna Ravenscroft
On 3/5/06, ingo <[EMAIL PROTECTED]> wrote: in news:[EMAIL PROTECTED] Kent Johnson wrote:[...]>>main(printtime(strf=None))>>[...] Anna, that results in an syntax error / invalid syntax>> It's very helpful to show the actual error and traceback.>Sorry, here it is:File "D:\Ingo\Py

Re: [Tutor] Analysing genetic code (DNA) using python

2006-03-06 Thread Anna Ravenscroft
On 3/6/06, sjw28 <[EMAIL PROTECTED]> wrote: I have many notepad documents that all contain long chunks of geneticcode. They look something like this:atggctaaactgaccaagcgcatgcgtgttatccgcgagaaagttgatgcaaccaaacagtacgacatcaacgaagctatcgcactgctgaaagagctggcgactgctaaattcgtagaa agcgtggacgtagctgttaacctcggcat

Re: [Tutor] how does this list comprehension work?

2006-03-08 Thread Anna Ravenscroft
On 3/8/06, Christopher Spears <[EMAIL PROTECTED]> wrote: I copied this program from Learning Python and got itto work on Windows XP:import sys, globprint sys.argv[1:]sys.argv = [item for arg in sys.argv for item inglob.glob(arg)]print sys.argv[1:] What the program does is first print the glob and t

Re: [Tutor] problems with numbers in my python code

2006-03-10 Thread Anna Ravenscroft
On 3/10/06, sjw28 <[EMAIL PROTECTED]> wrote: Basically, I have a code with is almost finished but I've having difficultlywith the last stage of the process. I have a program that gets assignsdifferent words with a different value via looking them up in a dictionary: eg if THE is in the writing, it

Re: [Tutor] Cannot Understand

2006-03-10 Thread Anna Ravenscroft
On 3/10/06, Edgar Antonio Rodriguez Velazco <[EMAIL PROTECTED]> wrote: Hi,Could you please explain this code?.f = lambda n: n-1 + abs(n-1) and f(n-1)*n or 1 This is why lambdas are evil. Officially, they are for creating "anonymous functions"; usually they only succeed in creating obscure unreadabl

Re: [Tutor] Cannot Understand

2006-03-10 Thread Anna Ravenscroft
On 3/10/06, Alan Gauld <[EMAIL PROTECTED]> wrote: >> Could you please explain this code?. f = lambda n: n-1 + abs(n-1) and f(n-1)*n or 1>>>This is why lambdas are evil.I meant to add to my last post that even using lambdas this is a weird attempt at a factorial fiunction.Here's the equivalent f

Re: [Tutor] Cannot Understand

2006-03-10 Thread Anna Ravenscroft
On 3/10/06, Alan Gauld <[EMAIL PROTECTED]> wrote: >> Could you please explain this code?. f = lambda n: n-1 + abs(n-1) and f(n-1)*n or 1>> This is why lambdas are evil.It's not the lambda thats evil its the need in Python to limit them to a single _expression_.If we writedef f(n):   return n-1

Re: [Tutor] *args consumption

2006-03-12 Thread Anna Ravenscroft
On 3/12/06, Kent Johnson <[EMAIL PROTECTED]> wrote: Danny has given some reasons why this is not useful standard behaviour.If this is a behaviour you need for many functions, you could create adecorator that provides it so you don't have to include the same boilerplate in each function.Decorators a

Re: [Tutor] Help with Game over program

2006-03-15 Thread Anna Ravenscroft
On 3/15/06, Brad Hills <[EMAIL PROTECTED]> wrote: I'm 45 minutes into learning how to program using python. I am reading "Python programming for the absolute begginer" by  Michael Dawson, and the first thing I've done was write the "Game Over" program. Which I understand is also called the "Hello W

Re: [Tutor] Python tutor

2006-03-28 Thread Anna Ravenscroft
On 3/27/06, Noufal Ibrahim <[EMAIL PROTECTED] > wrote: Greetings all,   Are there any programs for python that offer an "interactive" tutorial?Something on the lines of the builtin emacs tutorial (which isbasically just a buffer that tells you to try this and try that with itself) or the Inkscape t