(original) (raw)
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:
- Pre-generate the signatures and cache them in the \_\_signature\_\_ attribute.
- 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