functions without parentheses

Bengt Richter bokr at oz.net
Sat Jul 30 17:09:51 EDT 2005


On Sat, 30 Jul 2005 08:14:16 +0100, zen19725 at zen.co.uk (phil hunt) wrote:

>On Fri, 29 Jul 2005 06:37:52 GMT, Bengt Richter <bokr at oz.net> wrote:
>>
>>I suggested in a previous thread that one could support such a syntax by
>>supporting an invisible binary operator between two expressions, 
>
>That's a truely appalling idea.
>
>>so that
>>examine "string" translates to examine.__invisbinop__("string") if
>>examine as an expression evaluates to an object that has a __invisbinop__ method.
>>
>>Then you wouldn't define examine as a function, you would define it as an instance
>>of a class like
>>    class Examine(object):
>>        define __invisbinop__(self, other):
>>            #...whatever
>>    examine = Examine()
>>and then
>>    examine "string"
>
>Pass the sick bucket.
>
LOL ;-)

Regards,
Bengt Richter



More information about the Python-list mailing list