Overloading operators for currying, a PEP309 suggestion

Stephen Horne intentionally at blank.co.uk
Tue Mar 11 09:50:35 EST 2003


On 11 Mar 2003 15:38:41 +0100, Bernhard Herzog <bh at intevation.de>
wrote:

>Stephen Horne <intentionally at blank.co.uk> writes:
>
>> I would prefer defining the __len__, __getitem__, __setitem__ and
>> __delitem__ methods to allow direct manipulation (and creation and
>> deletion) of the closure.
>
>That would mean that the length of a function with no arguments is 0,
>right?

Probably

> That's bad and will likely introduce subtle bugs because then all
>functions with no arguments are suddenly considered false.

Why would a function object be treated as a boolean?

>What about other callable objects? Classes, methods or instances that
>have a __call__ method (They might even implement it through
>__getattr__)?

Good point.





More information about the Python-list mailing list