Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!feeder.news-service.com!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!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.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'bug': 0.02; '2.x': 0.05; 'arguments': 0.05; 'terry': 0.07; 'python': 0.07; '3.x': 0.09; 'attribute': 0.09; 'demonstrates': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:80.91.229.12': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'received:lo.gmane.org': 0.09; 'subject:Function': 0.09; 'tuple': 0.09; 'pm,': 0.11; 'def': 0.13; 'wrote:': 0.14; 'defaults,': 0.16; 'docs,': 0.16; 'f()': 0.16; 'jython': 0.16; 'obscure': 0.16; 'reedy': 0.16; 'argument': 0.16; 'matching': 0.16; 'object,': 0.19; 'jan': 0.22; 'header:In-Reply-To:1': 0.22; 'values': 0.23; 'ken': 0.23; 'platforms.': 0.23; "didn't": 0.25; 'point,': 0.25; 'pointed': 0.25; 'pointing': 0.25; 'specify': 0.25; 'function': 0.27; 'testing': 0.28; 'least': 0.30; 'argue': 0.31; 'does': 0.31; 'to:addr:python-list': 0.32; 'another': 0.32; 'idea': 0.32; 'url:docs': 0.33; 'test': 0.33; 'header:X-Complaints-To:1': 0.34; 'skip:" 10': 0.34; 'purposes': 0.35; 'header:User-Agent:1': 0.35; 'think': 0.36; 'case,': 0.36; 'none': 0.36; 'url:python': 0.37; '2.5': 0.38; 'url:org': 0.38; 'received:org': 0.38; 'to:addr:python.org': 0.39; 'could': 0.39; 'header:Mime- Version:1': 0.39; 'add': 0.39; 'containing': 0.40; 'tested': 0.40; 'would': 0.40; "it's": 0.40; 'header:Received:5': 0.40; 'respect': 0.60; 'url:5': 0.69; 'url:4': 0.72; "'test'": 0.84; '*does*': 0.84 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Terry Reedy Subject: Re: Function __defaults__ Date: Sun, 24 Apr 2011 17:53:59 -0400 References: <4db3f444$0$29978$c3e8da3$5496439d@news.astraweb.com> <4DB49473.4000204@seehart.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: rain.gmane.org User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.15) Gecko/20110303 Lightning/1.0b2 Thunderbird/3.1.9 In-Reply-To: <4DB49473.4000204@seehart.com> 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: 37 NNTP-Posting-Host: 82.94.164.166 X-Trace: 1303682052 news.xs4all.nl 81475 [::ffff:82.94.164.166]:37065 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:3963 On 4/24/2011 5:21 PM, Ken Seehart wrote: > Good point, Benjamin. I didn't think of testing on Jython before > answering. For practical purposes it's a really good idea to test > obscure features against all potential target platforms. > > In this case, I would argue that**Benjamin's test demonstrates a bug in > Jython. Benjamin's 'test' only tested that he could add a new attribute to a function object, as he did not use the proper 2.x name, func_defaults. > One could counter by pointing out that the documentation does not > specify that the __defaults__ attribute is writable. The 3.x docs, as another pointed out, does so specify. The same was true in 2.x at least by 2.5 http://docs.python.org/release/2.5.4/ref/types.html "func_defaults A tuple containing default argument values for those arguments that have defaults, or None if no arguments have a default value Writable" So if the following does not work in Jython 2.5 def f(a=42) : return a f() # 42 f.func_defaults = (23,) f() # 23 then it *does* have a bug with respect to matching the Python 2.5 spec. -- Terry Jan Reedy