Python from Wise Guy's Viewpoint
tjreedy at udel.edu
Tue Oct 21 02:56:01 CEST 2003
> I think it is not uniform that print and del are statements rather
> functions, since they don't do control flow (just like exec). In all
> three cases, I don't see why it is a statement.
If del were a function, we would have to write "del('a')" instead of
Preferable? Also, see my other post in this thread.
Assignment, the opposite of delete, also does not control flow. Like
delete, it requires an unevaluated name or indexing. As a function,
we would have to write 'set('x', 3) instead of x=3, and
set('lisp', 'ab') instead of lisp='ab', and settle for much
slower performance. For fun, try writing function set() (or del())
without using '=' (or del statement).
Terry J. Reedy
More information about the Python-list