[Python-Dev] PEP 362: 4th edition

Yury Selivanov yselivanov.ml at gmail.com
Fri Jun 15 23:38:10 CEST 2012


On 2012年06月15日, at 5:35 PM, Yury Selivanov wrote:
> On 2012年06月15日, at 5:30 PM, Antoine Pitrou wrote:
>>> On 2012年6月15日 17:26:25 -0400
>> Yury Selivanov <yselivanov.ml at gmail.com> wrote:
>>>>> On 2012年06月15日, at 5:13 PM, Antoine Pitrou wrote:
>>>>>>> On 2012年6月15日 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.
>>>> Ok, but what does this mean for 3.3? Does the PEP propose that all
>> builtins get a non-lazy __signature__, or simply that ValueError always
>> be raised?
>> Simply ValueError.

Although, Larry added __signature__ attribute to PyCFunctionObject
(None by default_. So those, who want to manually create signatures 
for their 'C' functions would be able to do that.
-
Yury


More information about the Python-Dev mailing list

AltStyle によって変換されたページ (->オリジナル) /