On 2013-06-10 17:20, Mark Janssen wrote:
> >> list = []
> >> Reading further, one sees that the function works with two
> >> lists, a list of file names, unfortunately called 'list',
> >
> > That is very good advice in general: never choose a variable name
> > that is a keyword.
>
> Btw, shouldn't it be illegal anyway? Most compilers don't let you
> do use a keyword as a variable name....
There's a subtle difference between a keyword and a built-in. Good
Python style generally avoids masking built-ins but allows it:
>>> "file" in dir(__builtins__)
True
>>> file = "hello" # bad style, but permitted
>>> print file
hello
Whereas the compiler prevents you from tromping on actual keywords:
>>> for = 4
File "<stdin>", line 1
for = 4
^
SyntaxError: invalid syntax
-tkc
--
http://mail.python.org/mailman/listinfo/python-list