A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2012-June/120314.html below:

[Python-Dev] PEP 362: 4th edition

[Python-Dev] PEP 362: 4th editionYury Selivanov yselivanov.ml at gmail.com
Fri Jun 15 23:26:25 CEST 2012
On 2012-06-15, at 5:13 PM, Antoine Pitrou wrote:

> On Fri, 15 Jun 2012 17:07:46 -0400
> Yury Selivanov <yselivanov.ml at gmail.com> wrote:
>> On 2012-06-15, at 4:48 PM, Victor Stinner wrote:
>> [snip]
>>> Would it be possible to only create a signature for builtin the first
>>> time that you read its __signature__ attribute? I don't know how to
>>> implement such behaviour on a builtin function. I don't know if it's
>>> important to decide this right now.
>>> 
>>> I don't want to create a signature at startup if it is not used,
>>> because it would waste memory (as docstrings? :-)).
>> 
>> I think when we have the working mechanism to generate them in place, 
>> we can make it lazy.
> 
> I'm not sure I understand. The PEP already says signatures are computed
> lazily. Is there an exception for built-in functions?

Right now, if there is no '__signature__' attribute set on a builtin
function - there is no way of generating it (PyCFunctionObject doesn't
have __code__), so a ValueError will be raised.  Maybe, if in the future
we replace PyArg_ParseTuple and family with something, that can generate
metadata for builtins (or generate Signature object, or generate some
callable that generates it, or something else) we make 'signature()' use it.
But again, that's not for 3.3.

And yes, signature() is still lazy.

-
Yury
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4