<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Fri, Jan 16, 2015 at 12:14 PM, Andrew Barnert <span dir="ltr"><<a href="mailto:abarnert@yahoo.com.dmarc.invalid" target="_blank">abarnert@yahoo.com.dmarc.invalid</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="auto"><div>One quick clarification question:</div><div><br></div><div>Can strings-as-forward-declarations be used inside non-string type annotations--e.g.. Set['Employee'] instead of 'Set[Employee]'? If so, do they have identical meaning?</div></div></blockquote><div><br></div><div>Yes. There's a FIXME in the PEP source to define forward references rigorously. See also <a href="https://github.com/ambv/typehinting/issues/34">https://github.com/ambv/typehinting/issues/34</a> <br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="auto"><div><br></div><div>I can imagine, say, a refactoring tool that didn't understand the full Python+MyPy syntax being able to do things with the former that it couldn't with the latter. And I think it might look more natural for simple recursive types. But those are just vague feelings, so don't take this as a suggestion.</div></div></blockquote><div><br></div><div>Well, the most common use case is where you are referencing the current class (which is in the process of being defined but isn't actually created until the entire class body is finished). E.g.<br><br>class Node(Generic[T]):<br></div><div>    def add_left(self, node: 'Node[T]'): ...<br></div></div><br>-- <br><div class="gmail_signature">--Guido van Rossum (<a href="http://python.org/~guido">python.org/~guido</a>)</div>
</div></div>