Re: another newbie question: why should you use "*args" ?
- From: Marc 'BlackJack' Rintsch <bj_666@xxxxxxx>
- Date: Wed, 31 Jan 2007 17:01:59 +0100
In <4b4a3$45c0b94c$83aef404$20934@xxxxxxxxxxxxxxxx>, stef wrote:
Eugene Antimirov wrote:
And one note more. Just to be more pythonic you shouldn't use formI would love that,
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] )
No need for the counter here.
for args in zip(list[1:], color[1:]):
plot(*args)
Ciao,
Marc 'BlackJack' Rintsch
.
- References:
- another newbie question: why should you use "*args" ?
- From: stef
- Re: another newbie question: why should you use "*args" ?
- From: Eugene Antimirov
- Re: another newbie question: why should you use "*args" ?
- From: stef
- another newbie question: why should you use "*args" ?
- Prev by Date: Re: error messages containing unicode
- Next by Date: subway
- Previous by thread: Re: another newbie question: why should you use "*args" ?
- Next by thread: Regex with ASCII and non-ASCII chars
- Index(es):