<br><br><div><span class="gmail_quote">On 12/19/06, <b class="gmail_sendername">Guido van Rossum</b> &lt;<a href="mailto:guido@python.org">guido@python.org</a>&gt; wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
On 12/18/06, Brett Cannon &lt;<a href="mailto:brett@python.org">brett@python.org</a>&gt; wrote:<br>&gt; On 12/18/06, Guido van Rossum &lt;<a href="mailto:guido@python.org">guido@python.org</a> &gt; wrote:<br>&gt; &gt; When you say &quot;just store strings&quot; do you mean that the implementation
<br>&gt; &gt; would be limited to strings or just that you would only use it to<br>&gt; &gt; store per-argument docstrings? The latter is fine with me; the former<br>&gt; &gt; seems an unnecessary restriction.<br>&gt;<br>
&gt; So code objects would grow a co_annotations that would be a tuple of strings<br>&gt; that stored what the annotations were as strings, with the last slot<br>&gt; reserved for returns.&nbsp;&nbsp;Any parameter that didn&#39;t have an annotation would
<br>&gt; have None assigned to it.&nbsp;&nbsp;This means that this code::<br>&gt;<br>&gt;&nbsp;&nbsp; def fxn(a:int, b, c:str=&#39;hi&#39;) -&gt; float: pass<br>&gt;<br>&gt; would have a co_annotations of ``(&#39;int&#39;, None, &#39;str&#39;, float)``.&nbsp;&nbsp;Keeping
<br>&gt; everything as strings keeps it simple and minimizes any performance impact<br>&gt; from them being declared.&nbsp;&nbsp;People can then easily write decorators that read<br>&gt; the tuple (or use signature objects) to type-check as desired.
<br><br>Sorry, that&#39;s not at all how I am envisioning it. Apart from being<br>stored in a different place I want these to work exactly the same way<br>as defaults -- they can be expressions with any value and whatever
<br>value they evaluate to at def time will be stored there.<br><br>(Another reason is that it&#39;s far from trivial for the parser to get<br>the actual text as a string, unless you very severely limit the<br>syntax, which I also don&#39;t want to see -- I want to be able to use
<br>List[int] for example.</blockquote><div><br>Ah, OK.&nbsp; Then I will stay out of Tony&#39;s way since he seems to be doing it the way you want.<br></div><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
&gt; Tony&#39;s implementation seems to actually fetch from globals what the<br>&gt; annotation specifies and I just don&#39;t think that is necessary and unneeded<br>&gt; overhead.<br><br>Why? I think it&#39;s the right thing to do. I&#39;ll have to look at his patch.
</blockquote><div><br>Because I was viewing the whole thing from a different perspective than you.&nbsp; =)<br></div><br>-Brett<br></div>