[Python-ideas] replace boolean methods on builtin types with properties [py4k?]

Jan Kaliszewski zuo at chopin.edu.pl
Wed Dec 15 11:04:45 CET 2010


1.
Masklinn dixit (2010-12-14, 12:31):

> Though I am −0 on the idea as well, this might be solveable by making
> properties callable and equivalent to unbound method aliases to their
> fget

There are no unbound methods in Py3k, but pure function instead. That
would make the issue even easier. There could be @callableproperty
decorator for such cases. I'd +0 on such an idea.

2.
Maybe better idea (if we want to avoid missed-parenthesis-mistakes)
would be to raise an error when trying to test such functions/methods
for truth. I could be achieved with a subclass of function type with
__bool__() method raising TypeError or NotImplementedError.

Cheers,
*j




More information about the Python-ideas mailing list