Converting a varargs tuple to a list - a definite pitfall for new comers to Python

metaperl metaperl at gmail.com
Fri Sep 15 06:26:38 EDT 2006


Georg Brandl wrote:
> metaperl.etc at gmail.com wrote:
> > The following program does not work if you uncomment     #lis =
> > ["xmms2"] + list(args)
> >
> > Evidently Python is opting for the nullary constructor list() as
> > opposed to the other one which takes a sequence. But no newcomer would
> > know this. And the Python docs dont give a good example of dealing with
> > taking a sequence of args and converting it to a list.
>
> Evidently you overlooked having defined a list() in global scope
> yourself which takes no arguments.

MASSIVELY overlooked it. Gosh. How embarrassing.




More information about the Python-list mailing list