<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">On Aug 15, 2014, at 8:17 AM, Guido van Rossum <<a href="mailto:guido@python.org">guido@python.org</a>> wrote:<br><div><br class="Apple-interchange-newline"><blockquote type="cite"><div style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div>You can probably come up with a notation for first-class variable annotations, e.g.</div><div><br></div><div>    x: Sequence[int] = []<br></div></div></div></div></div></blockquote><div><br></div><div>Yes, that syntax is out of scope for now, though, right? If I understand your reasoning behind choosing Mypy’s function annotation syntax, we don’t want to create programs that require Python 3.5+ just to be parsed.</div><div><br></div><div>If we were to introduce first-class variable typing, yes, the syntax you propose is what I also had in mind.</div><div><br></div><br><blockquote type="cite"><div style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div>The value might be optional. The question is though, would the type (Sequence[int]) be stored anyway? Also, in a class body, does it define a class var or an instance var (or doesn't it matter?).</div></div></div></div></div></blockquote><div><br></div><div>I wouldn’t change the current behaviour:</div><div><br></div><div>class C:</div><div>  cls_member: str = ‘on the class’</div><div><br></div><div>  def __init__(self):</div><div>    self.obj_member: str = ‘on the instance'</div><div>    self.cls_member = 2   # that’s the real question: type error or an instance member?</div><div><br></div><div>For that last case, even though it’s currently valid Python, my intuition tells me for Mypy to treat it as an error. </div><div><br></div><div><br></div><blockquote type="cite"><div style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div>Does this need a 'var' keyword to be ambiguous?<br></div></div></div></div></div></blockquote><div><br></div><div>I fail to see any additional value provided by such keyword. What would stop people from doing</div><div><br></div><div>var i = 1</div><div><br></div><div>I don’t think we want to end up with that.</div><div><br></div><br><blockquote type="cite"><div style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div>I propose to disallow declaring multiple variables in this style, since it's hard to decide whether the comma should bind tighter than the '=' sign (as in assignments) or less tight (as in function headings).</div></div></div></div></div></blockquote><div><br></div><div>Right. I wonder if we even need this. For lines that use multiple assignment just for brevity, they can switch to multiple lines for typing. For common cases like:</div><div><br></div><div>host, port = origin.rsplit(‘:’, 1)</div><div>successful, errors = query_the_world(hostnames)</div><div><br></div><div>I think the types can be easily inferred (assuming rsplit and query_the_world are annotated).</div><div><br></div><br><blockquote type="cite"><div style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex; position: static; z-index: auto;"><div style="word-wrap: break-word;"><div>While we’re at slaying dragons, I’ll also silently make str non-iterable so that we can use Sequence[str] meaningfully from now on… How about that?</div><span class="HOEnZb"></span></div></blockquote></div><br></div><div class="gmail_extra">I hope you meant that as a joke. We missed our chance for that one with Python 3.0. We must live with it.<br clear="all"></div></div></div></blockquote></div><br><div>Yes, that was obviously just a joke. By the way, is the PEP number 4000 free? Asking for a friend.</div><div><br></div><div><span style="font-family: 'Lucida Grande'; orphans: 2; text-align: -webkit-auto; widows: 2;">-- </span></div><div><div apple-content-edited="true"><div style="font-family: 'Lucida Grande'; orphans: 2; text-align: -webkit-auto; widows: 2; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">Best regards,<br>Łukasz Langa<br><br>WWW: <a href="http://lukasz.langa.pl/">http://lukasz.langa.pl/</a><br>Twitter: @llanga<br>IRC: ambv on #python-dev</div></div><br><div></div></div></body></html>