user-defined operators: a very modest proposal

Antoon Pardon apardon at forel.vub.ac.be
Thu Nov 24 03:37:33 EST 2005


Op 2005-11-22, jepler at unpythonic.net schreef <jepler at unpythonic.net>:
>     * Should some of the unicode mathematical symbols be reserved for literals?
>       It would be greatly preferable to write \u2205 instead of the other proposed
>       empty-set literal notation, {-}.  Perhaps nullary operators could be defined,
>       so that writing \u2205 alone is the same as __u2205__() i.e., calling the
>       nullary function, whether it is defined at the local, lexical, module, or
>       built-in scope.

Isn't this essentially already happening with lists?.

And isn't something like this already possible with properties, except
for the scoping.

If python would develop the property idea a bit further and have
variables that would call a function each time they are accessed,
something like this could work.

-- 
Antoon Pardon



More information about the Python-list mailing list