Python from Wise Guy's Viewpoint

Terry Reedy tjreedy at udel.edu
Mon Oct 20 20:56:01 EDT 2003



> I think it is not uniform that print and del are statements rather
than
> 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
"del a".
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[13]', 'ab') instead of lisp[13]='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 mailing list