Serhiy Storchaka added the comment:
> It doesn't solve the case when an identifier or number is used as a function:
In the first case we should convert an argument to integer.
ns = {}
exec('''if True:
def func(arg):
n = int(arg)
return {}
'''.format(plural), ns)
return ns['func']
Or raise an exception if argument is not integer.
In the second case I think we can just left it as is. This is not valid C
expression.
Or we can add try/except in above code and convert TypeError to ValueError if
this is more preferable exception.
----------
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue28563>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com