[Python-3000] Special object to return from functions that return only None
Edward C. Jones
edcjones at comcast.net
Wed Apr 19 03:41:20 CEST 2006
Wild idea.
When I was a newbie, I repeatedly make the mistake of writing
alist = alist.sort()
I suggest a singleton object "UseForbidden" ("Py_UseForbidden" in C).
"UseForbidden" can be used only to return from a function. Any other
attempt to use "UseForbidden" raises an exception. The incorrect code
above would give the error message "cannot assign to result of function".
More information about the Python-3000
mailing list