another puzzled newbie
Erik Max Francis
max at alcyone.com
Thu Aug 28 22:05:09 EDT 2003
Elaine Jackson wrote:
> "Chad Netzer" <cnetzer at sonic.net> wrote in message
> news:mailman.1062051053.30902.python-list at python.org...
>
> > You don't need the '(' and ')' here. del is a keyword, not a
> > function.
>
> Can't it be both? Could you explain why it fails to be a function?
Because it doesn't only not return a value, it _can't_ return a value:
>>> def f(x): print x
...
>>> f("This is a function")
This is a function
>>> returnValue = f("This is a function")
This is a function
>>> returnValue is None
True
>>> g = f
>>> del f
>>> returnValue = del f
File "<stdin>", line 1
returnValue = del f
^
SyntaxError: invalid syntax
Treating del as if it were a function is illegal. The same goes for the
other statements, like print.
--
Erik Max Francis && max at alcyone.com && http://www.alcyone.com/max/
__ San Jose, CA, USA && 37 20 N 121 53 W && &tSftDotIotE
/ \ The average dog is a nicer person than the average person.
\__/ Andrew A. Rooney
More information about the Python-list
mailing list