Re: another newbie question: why should you use "*args" ?
- From: stef <s.mientki@xxxxxxxxxx>
- Date: Wed, 31 Jan 2007 16:44:11 +0100
Eugene Antimirov wrote:
stef wrote:I would love that,
# method 2
def chunk_plot(self, list):
for i in range ( len(list) ):
.... do something
And one note more. Just to be more pythonic you shouldn't use form range(len(blabla)). Instead use:
for i in list:
....blabla...
but please tell me how (I need an integer counter for something else too):
def chunk_plot(*args):
if len(args) == 1: list = args[0]
else: list = args
color = ['g','r','b','y','m']
plot ( list[0], color[0])
hold (True)
for i in range ( 1, len(list) ):
plot ( list[i], color[i] )
cheers,
Stef
.
- Follow-Ups:
- Re: another newbie question: why should you use "*args" ?
- From: Marc 'BlackJack' Rintsch
- Re: another newbie question: why should you use "*args" ?
- From: Jeffrey Froman
- Re: another newbie question: why should you use "*args" ?
- References:
- another newbie question: why should you use "*args" ?
- From: stef
- Re: another newbie question: why should you use "*args" ?
- From: Eugene Antimirov
- another newbie question: why should you use "*args" ?
- Prev by Date: Re: "Correct" db adapter
- Next by Date: Re: another newbie question: why should you use "*args" ?
- Previous by thread: Re: another newbie question: why should you use "*args" ?
- Next by thread: Re: another newbie question: why should you use "*args" ?
- Index(es):