<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    Richard, I don't think I can provide you with a "why" for dynamic
    typing.  It's a choice Guido made early on, one that is central to
    the language, and one that I think pays off in the long run.  Values
    are objects, which are typed.  Names are untyped, and can refer to
    any value, regardless of what value they referred to in the past. 
    Therefore, it doesn't make sense to talk about the type of a name,
    which is all that a type declaration could do.<br>
    <br>
    This is very different than some other programming languages, but I
    don't know if it could be called unintuitive.  I'm not sure anything
    about programming could truly be called intuitive, I think the
    closest we can get is "familiar".  Certainly if you've worked with
    statically typed languages before, then dynamic typing is
    unfamiliar.<br>
    <br>
    I worry that you are still placing dynamic typing into a category
    you call "gotchas" or "quirks", with the word "fixes" nearby. 
    Dynamic typing cannot be "fixed", it is central to the language.  I
    think it is great to write something to help those new to Python,
    but you should be sure that you fully understand Python before you
    undertake it.<br>
    <br>
    --Ned.<br>
    <br>
    On 12/11/2011 4:30 PM, Richard Prosser wrote:
    <blockquote
cite="mid:CAJvrtnvP5u4nHe161xzLAAzB6Rz4iFshd0bZYU25EmgN-nMHSQ@mail.gmail.com"
      type="cite">Ned,<br>
      <br>
      I accept your comment about the tutorial - I wasn't sure about
      that. Thanks.<br>
      <br>
      However I still feel that there are some aspects of the language
      which are not in the true spirit of Python (i.e. 'intuitive').<br>
      <br>
      The discussion about default mutable types is one of these. It
      seems to me that the essential problem is that of assignment in
      general, which (I believe) creates a reference on the LHS to the
      object on the RHS, rather than having a copy operation to make the
      two objects completely separate. That can be confusing in other
      contexts, not just with default parameters.<br>
      <br>
      If I am to write a 'gotchas' FAQ or whatever then I would like to
      understand the reasoning behind such design decisions but I can't
      find any 'deep' explanations at present - just several posts about
      people being puzzled! A similar comment applies to the lack of
      type declarations.<br>
      <br>
      So if you or anyone else can explain exactly why such odditties
      are implemented I would be grateful.<br>
      <br>
      Unfortunately it is almost certainly too late to propose fixes (if
      appropriate) for such quirks in Python 3 but at least I should be
      able provide arguments as to why things are done the way they are.<br>
      <br>
      <br>
      Richard<br>
      <br>
      <br>
      <div class="gmail_quote">On 11 December 2011 01:21, <span
          dir="ltr"><<a moz-do-not-send="true"
            href="mailto:python-ideas-request@python.org">python-ideas-request@python.org</a>></span>
        wrote:<br>
        <blockquote class="gmail_quote" style="margin:0 0 0
          .8ex;border-left:1px #ccc solid;padding-left:1ex">
          <div id=":yr">Message: 2<br>
            Date: Sat, 10 Dec 2011 13:34:15 -0500<br>
            From: Ned Batchelder <<a moz-do-not-send="true"
              href="mailto:ned@nedbatchelder.com">ned@nedbatchelder.com</a>><br>
            To: Richard Prosser <<a moz-do-not-send="true"
              href="mailto:richard.prosser@mail.com">richard.prosser@mail.com</a>><br>
            Cc: <a moz-do-not-send="true"
              href="mailto:python-ideas@python.org">python-ideas@python.org</a><br>
            Subject: Re: [Python-ideas] Python Isn't Perfect: adding a
            'gotchas'<br>
                   section to the tutorial<br>
            Message-ID: <<a moz-do-not-send="true"
              href="mailto:4EE3A627.8010002@nedbatchelder.com">4EE3A627.8010002@nedbatchelder.com</a>><br>
            Content-Type: text/plain; charset=ISO-8859-1; format=flowed<br>
            <br>
            On 12/10/2011 9:16 AM, Richard Prosser wrote:<br>
            > Although I love Python there are some aspects of the
            language design<br>
            > which are disappointing and which can even lead to
            problems in some cases.<br>
            ><br>
            > A classic example is a mutable default argument having
            the potential<br>
            > to produce unexpected side-effects, as a consequence of
            the<br>
            > non-intuitive scoping rules.<br>
            ><br>
            > Another awkward 'feature' is the requirement for a
            trailing comma in<br>
            > singleton tuples, due I believe to the use of
            expression parentheses<br>
            > rather than (say) the use of special brackets like
            chevrons.<br>
            ><br>
            > Something that I personally wish for is the ability to
            declare<br>
            > variable types 'up front' but that facility is missing
            from Python.<br>
            ><br>
            One of these things is not like the others.  Mutable default
            arguments,<br>
            and singleton tuples are surprises that make sense once you
            understand<br>
            things on a deeper level.  It makes sense to call them out
            as a<br>
            "gotcha": a common stumbling block for learners.  But "no
            type<br>
            declarations" is not a wart, it's a fundamental feature of
            the language<br>
            that is immediately apparent from the first lesson.<br>
            <br>
            --Ned.</div>
        </blockquote>
      </div>
      <br>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
Python-ideas mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Python-ideas@python.org">Python-ideas@python.org</a>
<a class="moz-txt-link-freetext" href="http://mail.python.org/mailman/listinfo/python-ideas">http://mail.python.org/mailman/listinfo/python-ideas</a>
</pre>
    </blockquote>
  </body>
</html>