For all the talk of Python only having one way to do something which is
why it's so much better than Perl, I've counted about 10 ways to do this
:-)

Jeff

-----Original Message-----
From: Sean Perry [mailto:[EMAIL PROTECTED] 
Sent: Friday, March 25, 2005 2:20 PM
To: Tutor Tutor
Subject: Re: [Tutor] a shorter way to write this


jrlen balane wrote:
> basically, i'm going to create a list with 96 members but with only 
> one value:
> 
> list1[1,1,1,1...,1]
> 
> is there a shorter way to write this one???

def generateN(n):
     while 1:
         yield n

I'll leave the actual list creation up to you (-:
_______________________________________________
Tutor maillist  -  [email protected]
http://mail.python.org/mailman/listinfo/tutor
_______________________________________________
Tutor maillist  -  [email protected]
http://mail.python.org/mailman/listinfo/tutor

Reply via email to