<br><br><div><span class="gmail_quote">On 12/19/06, <b class="gmail_sendername">Guido van Rossum</b> <<a href="mailto:guido@python.org">guido@python.org</a>> 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 <<a href="mailto:brett@python.org">brett@python.org</a>> wrote:<br>> On 12/18/06, Guido van Rossum <<a href="mailto:guido@python.org">guido@python.org</a> > wrote:<br>> > When you say "just store strings" do you mean that the implementation
<br>> > would be limited to strings or just that you would only use it to<br>> > store per-argument docstrings? The latter is fine with me; the former<br>> > seems an unnecessary restriction.<br>><br>
> So code objects would grow a co_annotations that would be a tuple of strings<br>> that stored what the annotations were as strings, with the last slot<br>> reserved for returns. Any parameter that didn't have an annotation would
<br>> have None assigned to it. This means that this code::<br>><br>> def fxn(a:int, b, c:str='hi') -> float: pass<br>><br>> would have a co_annotations of ``('int', None, 'str', float)``. Keeping
<br>> everything as strings keeps it simple and minimizes any performance impact<br>> from them being declared. People can then easily write decorators that read<br>> the tuple (or use signature objects) to type-check as desired.
<br><br>Sorry, that'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'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't want to see -- I want to be able to use
<br>List[int] for example.</blockquote><div><br>Ah, OK. Then I will stay out of Tony'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;">
> Tony's implementation seems to actually fetch from globals what the<br>> annotation specifies and I just don't think that is necessary and unneeded<br>> overhead.<br><br>Why? I think it's the right thing to do. I'll have to look at his patch.
</blockquote><div><br>Because I was viewing the whole thing from a different perspective than you. =)<br></div><br>-Brett<br></div>