Path: csiph.com!usenet.pasdenom.info!news.albasani.net!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!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.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'from:addr:yahoo.co.uk': 0.04; 'argument': 0.05; 'defaults': 0.07; '(unicode': 0.09; 'immutable': 0.09; 'lawrence': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; "they've": 0.09; 'def': 0.12; 'bug': 0.12; '"good': 0.16; 'dict': 0.16; 'fork': 0.16; 'frozenset': 0.16; 'immutable,': 0.16; 'list"': 0.16; 'mutable': 0.16; 'mutated': 0.16; 'naming': 0.16; 'prohibit': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'str)': 0.16; 'tuple': 0.16; 'sat,': 0.16; 'wrote:': 0.18; 'restrictions': 0.19; 'putting': 0.22; 'header:User-Agent:1': 0.23; 'bytes': 0.24; 'developers': 0.25; 'this:': 0.26; 'defined': 0.27; 'header:X -Complaints-To:1': 0.27; 'header:In-Reply-To:1': 0.27; 'function': 0.29; 'chris': 0.29; 'ball': 0.31; "d'aprano": 0.31; 'restricted': 0.31; 'steven': 0.31; 'tuples': 0.31; 'know.': 0.32; 'themselves': 0.32; 'something': 0.35; 'objects': 0.35; 'right?': 0.36; 'next': 0.36; 'list': 0.37; 'to:addr:python-list': 0.38; 'that,': 0.38; 'little': 0.38; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'how': 0.40; 'black': 0.61; 'here': 0.66; 'bothered': 0.68; 'nobody': 0.68; 'watching': 0.68; 'safe': 0.72; 'fortunately,': 0.84; 'happen!': 0.84; 'subject:Value': 0.84; 'white,': 0.84; 'url:php': 0.85; 'horror': 0.91; 'imagine': 0.93; '2013': 0.98 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Mark Lawrence Subject: Re: Default Value Date: Sat, 22 Jun 2013 09:26:12 +0100 References: <7e6361d5-6619-4aaa-adda-8b5f01bde57f@googlegroups.com> <447dd1c6-1bb2-4276-a109-78d7a067b442@d8g2000pbe.googlegroups.com> <2e92b4c7-31be-40d2-a906-ab19f3630dfa@googlegroups.com> <51c477dd$0$29999$c3e8da3$5496439d@news.astraweb.com> <565a1c8f-6fd9-4bab-9834-076eaea527f8@googlegroups.com> <7e1ed740-df18-4978-b11d-8ca9c4b5bd04@googlegroups.com> <51c4fe76$0$29999$c3e8da3$5496439d@news.astraweb.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: host-92-24-210-99.ppp.as43234.net User-Agent: Mozilla/5.0 (Windows NT 6.0; rv:17.0) Gecko/20130509 Thunderbird/17.0.6 In-Reply-To: <51c4fe76$0$29999$c3e8da3$5496439d@news.astraweb.com> X-Antivirus: avast! (VPS 130621-3, 21/06/2013), Outbound message X-Antivirus-Status: Clean X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 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: 36 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1371889585 news.xs4all.nl 16006 [2001:888:2000:d::a6]:37071 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:48919 On 22/06/2013 02:31, Steven D'Aprano wrote: > On Sat, 22 Jun 2013 05:07:59 +1000, Chris Angelico wrote: > >> Oh! I know. Function argument defaults will now be restricted to >> int/float/tuple. That would do it, right? Nobody would be bothered by >> little restrictions like that, would they. > > Alas, tuples won't do it. Fortunately, you can include str and bytes > (unicode and str) and frozenset in the "Good List". Tuples have to go > into the "Bad List" because, although they themselves are immutable, > their contents may not be. Imagine the confusion and horror that poor > developers will experience when they do something like this: > > def func(arg, extra=(23, 'foo', [])): > [code goes here...] > extra[2].append("something") > [more code...] > > > and they've now mutated the immutable default! > > Thinking about this, I think that the only safe thing to do in Rickython > 4000 is to prohibit putting mutable objects inside tuples. Putting a list > or a dict inside a tuple is just a bug waiting to happen! > How about naming the fork RickedPython 4000, where ricked is defined here http://www.urbandictionary.com/define.php?term=ricked ? -- "Steve is going for the pink ball - and for those of you who are watching in black and white, the pink is next to the green." Snooker commentator 'Whispering' Ted Lowe. Mark Lawrence