On 06/15/2012 02:13 PM, Antoine Pitrou wrote:
I'm not sure I understand. The PEP already says signatures are computed
lazily. Is there an exception for built-in functions?
Right now we have no way to automatically generate signatures for
built-in functions. So, as of current trunk, any such signatures would
have to be built by hand.
If we could somehow produce signature information in C, what then? Two
possible approaches suggest themselves:
1. Pre-generate the signatures and cache them in the __signature__
attribute.
2. Add a callback, perhaps named __get_signature__(), which calculates
the signature and returns it.
Both approaches have downsides. The former means generation is not lazy
and therefore consumes more memory. The latter adds a new attribute to
builtin functions.
Which is a better approach? Who knows? We don't even have the
signature information in C yet. As we all learned from Star Trek VI,
the future is an undiscovered country. So the PEP deliberately makes no
ruling here.
//arry/
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com