John Machin wrote:
> [EMAIL PROTECTED] 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.
>
> Are you using "the nullary constructor list()" to mean "the 0-argument
> function list() that appears later in the script", and "the other one
> which takes a sequence" to mean the builtin function list()"???

No,  I'm talking about listing 2 here:
http://www-128.ibm.com/developerworks/library/os-python4/index.html

which states:
"If you look closely at the description for the list class in Listing
2, you'll see that two different constructors are provided. One takes
no arguments, and the other takes a sequence class."

and I figured that since the lower bound on arguments to *args could
zero, that Python was
default to the nullary constructor even before the function got its
args.

paranoia will do these things to you.


>
> >  And the Python docs dont give a good example of dealing with
> > taking a sequence of args and converting it to a list.
>
> You have produced 2 perfectly good examples yourself. What's your
> point?

I just mean that this:
http://docs.python.org/tut/node6.html#SECTION006730000000000000000

does not use list() at all.



> Here's a tip: when you get into a pickle like that, try running
> pychecker and/or pylint over your code. Here's what pychecker has to
> say:
>
> metaperllist.py:4: Invalid arguments to (list), got 1, expected 0
> metaperllist.py:10: (list) shadows builtin


Great suggestion. I had not heard of those. Thanks.

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to