Guido van Rossum wrote: > On 4/19/06, Edward C. Jones <[EMAIL PROTECTED]> wrote: > >>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". > > > Apart from assignment, None already has very few methods, so it > already has this purpose. > > Trapping this on assignment would require *every* assignment (and > argument passing, and who knows what else) to pay for the overhead for > an additional specific check. I don't think that's feasible.
It also makes pass-through decorators and delegates harder. At least if you make it any stronger than what None already is. None doesn't do anything, but you can pass it around. You could disallow the passing around of a UseForbidden object, but then you need special ways of saying things like "run this function, give me the return value, and really this time it's okay if it is a UseForbidden object". -- Ian Bicking / [EMAIL PROTECTED] / http://blog.ianbicking.org _______________________________________________ Python-3000 mailing list Python-3000@python.org http://mail.python.org/mailman/listinfo/python-3000 Unsubscribe: http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com