Path: csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.007 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'subject:Python': 0.05; 'tends': 0.07; 'python': 0.08; 'arguments,': 0.09; 'immutable': 0.09; 'mutable': 0.09; '"python': 0.15; 'argument': 0.15; 'alex23': 0.16; 'disagree.': 0.16; 'feel,': 0.16; 'longer.': 0.16; 'maybe,': 0.16; 'mechanics.': 0.16; 'met,': 0.16; 'non-python': 0.16; 'previously,': 0.16; 'cc:addr:python-list': 0.16; 'wrote:': 0.18; 'arguments': 0.18; 'of.': 0.18; 'cc:no real name:2**0': 0.21; "doesn't": 0.22; 'header:In-Reply-To:1': 0.22; 'received:209.85.212.46': 0.23; 'incorrect': 0.23; 'mask': 0.23; 'happening': 0.24; 'keyword': 0.24; "python's": 0.24; 'modify': 0.25; 'cc:2**0': 0.26; 'code': 0.26; 'lists': 0.28; 'tend': 0.28; 'pass': 0.29; 'message-id:@mail.gmail.com': 0.29; 'explicitly': 0.29; 'options:': 0.29; 'problem': 0.29; 'cc:addr:python.org': 0.29; 'pm,': 0.29; '(and': 0.30; 'arguments.': 0.30; 'sun,': 0.30; "they'll": 0.30; 'chris': 0.30; 'pretty': 0.31; 'on,': 0.31; 'skip:( 30': 0.31; 'programmers': 0.32; 'idea': 0.32; 'changing': 0.32; 'there': 0.33; 'received:209.85.212': 0.33; 'principle': 0.34; 'things': 0.35; 'two': 0.36; 'issue': 0.37; 'but': 0.37; 'received:google.com': 0.37; 'skip:" 10': 0.37; 'received:209.85': 0.38; 'could': 0.38; 'problems': 0.38; 'unless': 0.39; 'received:209': 0.39; 'point': 0.40; 'hit': 0.40; 'might': 0.40; 'easy': 0.60; 'bring': 0.61; 'john': 0.61; 'more': 0.61; 'teach': 0.61; 'improve': 0.62; 'dangerous': 0.64; 'ever': 0.64; 'soon': 0.72; 'mean.': 0.73; 'expectations': 0.77; '"obvious"': 0.84; 'lesson.': 0.84; 'mechanics': 0.84; 'sender:addr:chris': 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rebertia.com; s=google; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=WPY4/K5dz8ZXFQfbL7ZjfVMBWxnGZ42sUurdyDGmaro=; b=J3EcbRSDaqp577IiVkntN1Ktvzjh3aNzkVzMEhMuJTwYM0h/DvKE1ZQjDU+RN53QOs aCJZo9wxLFvuPrj6p75kxQCb6M1F0uo+wGIzp/Y2miyxSEr6jViayY5LbEaJ17gaO/Jd X7qPJdMaxFZgUClNOTP4RYobHQwAhXV5uFfzg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding:x-gm-message-state; bh=WPY4/K5dz8ZXFQfbL7ZjfVMBWxnGZ42sUurdyDGmaro=; b=krIT8hejjJMWR/UMz4ha6DSKXhjCH15y7NqstVYZ8lf7NOKVyzGJbLhGvX3105Wh6X vYSQdX3A12VCilYeoRSwyzTGVhNUpEw2QCRt05D6hZoGBBDylVyXw07RHgPLs+mgyTIk vuvdTE7NFloLdSX8HPef6HAR5ipaG1IK0HFntRZMbB/HmPWTbzgEPOfPTCUrW2N+jwcP kLIs1gJcE5KNDQ4ReHjtCiPbncM9BwOE50P5rgYA52hDtFD4LPzLdq3L3RAeCrYMj7TP XCz3feslJPcuCaUqpaGWH/GiOsAId7vaI+4rNWLhcGFxsbaplACCHygZL5xxHpUnoFLB ++kw== MIME-Version: 1.0 Sender: chris@rebertia.com In-Reply-To: <3904be71-335e-43a9-9e82-024abb1729b5@ni10g2000pbc.googlegroups.com> References: <4f612b19$0$1379$4fafbaef@reader2.news.tin.it> <8e72d74f-c844-4de3-8a37-f6b1fdc2291f@y27g2000yqy.googlegroups.com> <50e9ceec-40f1-4ead-b2b6-87328b30d084@ow8g2000pbc.googlegroups.com> <3904be71-335e-43a9-9e82-024abb1729b5@ni10g2000pbc.googlegroups.com> Date: Sun, 18 Mar 2012 21:14:27 -0700 X-Google-Sender-Auth: Hw2CYVykdjMh8LxArnvAOmScFpA Subject: Re: Python is readable From: Chris Rebert To: alex23 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Gm-Message-State: ALoCoQnnTQ99E+L89hsUlXsQaC5idNW7yGr1GR8oO747kEGR07r9K8DBRCkfBZWxeAcKcxkl6H2p Cc: python-list@python.org X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 41 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1332130470 news.xs4all.nl 6885 [2001:888:2000:d::a6]:49562 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:21874 On Sun, Mar 18, 2012 at 8:15 PM, alex23 wrote: > John Ladasky wrote: >> > The idea that Python code has to be obvious to non-programmers is an >> > incorrect and dangerous one. >> >> Incorrect? =C2=A0Probably. =C2=A0Dangerous? =C2=A0You'll have to explain= what you >> mean. > > The classic "obvious" behaviour to new Python programmers that causes > problems would be mutable default arguments. At this point you have > two options: improve the "readability" to new users so their > expectations are met, or ask them to modify those expectations and > understand what's really happening under the surface. As it stands, > you tend to hit this problem pretty early on, learn about it, and walk > away with a deeper knowledge of Python's mechanics. The mechanics of default arguments maybe, but that's tautological. If you mean call-by-object, any time you pass both mutable and immutable things around, you will learn the same lesson. If you mean the more general principle that "Python doesn't ever copy things unless you explicitly ask", working with lists (and particularly their multiplication operator) again tends to also teach that lesson. > The danger, I > feel, is that changing it to better fit the mind-set that non-Python > programmers bring with them could mask that necessary understanding > for longer. I disagree. Just add a keyword for each default argument evaluation behavior (evaluate-once-at-definition-time [e.g. "once", "static"] and evaluate-at-call-time [e.g. "fresh"]) and don't have there be a default behavior; make the choice explicit. They'll be confronted with the issue as soon as they're shown default arguments, and keywords are easy to look up the meaning of. And as I said previously, there are other common ways to learn any of the "lessons" that default arguments might "teach". If-I-had-my-druthers-ly yours, Chris (R.)