On 2008-02-14, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> Hi,
>
> In the standard library module "operator", it would be nice to have a 
> dictionary
> mapping operators strings with their respective functions. Something like:
>
>   {
>     '+': add,
>     '-': sub,
>     'in': contains,
>     'and': and_,
>     'or': or_,
>     ...
>   }
>
> Does such a dictionary already exist? Is it really a good and useful idea?

How would you handle changes in operator syntax?
- I have 'add' instead of '+'
- I have U+2208 instead of 'in'

I don't think this is generally applicable.


Why don't you attach the function to the +/-/in/... token instead? Then you
don't need the above table at all.


sincerely,
Albert
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to