[Python-Dev] PyPy, Jython, & IronPython: Enum convenience function and pickleablity
duda.piotr at gmail.com
Fri May 3 19:20:26 CEST 2013
2013/5/3 Barry Warsaw <barry at python.org>:
> On May 03, 2013, at 07:40 PM, Steven D'Aprano wrote:
>>The problem is that this is not an expression, it is a statement. The
>>advantage of the convenience function is not just that it is shorter, but
>>that it is an expression.
> Exactly right, but let's stop calling it the "convenience API" and instead
> call it the "functional API". I probably started the perpetuation of this
> problem; let's update the PEP.
> BTW, I made a suggestion elsewhere that the first argument could accept, but
> not require dotted names in the first argument. If provided, rsplit the
> string and use the prefix as __module__. If not given, fallback to the
> _getframe() hack for those implementations where it's available.
What about adding simple syntax that allows get rid of those ugly
hacks, something like:
def name = expression
which would be rough equivalent for:
name = expression
name.__name__ = 'name'
name.__module__ = __name__
More information about the Python-Dev