accessing elements of a tuple

D'Arcy J.M. Cain darcy at druid.net
Sun Feb 1 15:32:42 CET 2009


On Sun, 01 Feb 2009 19:23:58 +1100
Steven D'Aprano <steve at pearwood.info> wrote:
> D'Arcy J.M. Cain wrote:
> 
> > First of all, list is a reserved word.  Don't use it as a variable name.
> 
> Unless you mean to. Shadowing built-ins is only a bad thing when you do it
> by accident.

I suppose but I am having a hard time trying to think of some good
reason to replace a builtin function that creates a list with a list
object.

>>> list = list((1,2,3))
>>> list((1,2,3))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: 'list' object is not callable

-- 
D'Arcy J.M. Cain <darcy at druid.net>         |  Democracy is three wolves
http://www.druid.net/darcy/                |  and a sheep voting on
+1 416 425 1212     (DoD#0082)    (eNTP)   |  what's for dinner.



More information about the Python-list mailing list