Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!feeder.news-service.com!newsfeed.xs4all.nl!newsfeed6.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; '3.x': 0.09; '>>>>': 0.09; 'demonstrates': 0.09; 'subject:Function': 0.09; 'pm,': 0.11; '25,': 0.12; 'def': 0.13; 'am,': 0.14; 'wrote:': 0.14; '"copyright",': 0.16; '"credits"': 0.16; '"license"': 0.16; '456': 0.16; "doesn't.": 0.16; 'gotta': 0.16; 'jython': 0.16; 'obscure': 0.16; 'received:192.168.1.20': 0.16; 'received:74.55.86': 0.16; 'received:74.55.86.74': 0.16; 'received:smtp.webfaction.com': 0.16; 'received:webfaction.com': 0.16; 'test()': 0.16; 'header:In-Reply-To:1': 0.22; 'mon,': 0.22; '(and': 0.22; 'ken': 0.23; 'platforms.': 0.23; "didn't": 0.25; 'point,': 0.25; 'expect': 0.26; 'there.': 0.26; 'testing': 0.28; 'server': 0.29; 'daniel': 0.29; 'skip:( 20': 0.31; 'argue': 0.31; 'to:addr:python-list': 0.32; '...': 0.32; 'idea': 0.32; 'test': 0.33; 'received:192.168.1': 0.34; 'received:192': 0.34; 'there': 0.35; 'purposes': 0.35; 'that,': 0.35; 'header:User-Agent:1': 0.35; 'yet,': 0.35; 'think': 0.36; 'case,': 0.36; 'received:192.168': 0.37; 'should': 0.37; 'apr': 0.38; 'to:addr:python.org': 0.39; 'would': 0.40; "it's": 0.40; '2011': 0.62; 'mar': 0.64; 'microsystems': 0.84 Date: Sun, 24 Apr 2011 14:54:33 -0700 From: Ken Seehart User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.15) Gecko/20110303 Thunderbird/3.1.9 MIME-Version: 1.0 To: python-list@python.org Subject: Re: Function __defaults__ References: <4db3f444$0$29978$c3e8da3$5496439d@news.astraweb.com> <4DB49473.4000204@seehart.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit 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: 32 NNTP-Posting-Host: 82.94.164.166 X-Trace: 1303682074 news.xs4all.nl 81482 [::ffff:82.94.164.166]:37296 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:3964 Gotta love that email latency. :-D Ken On 4/24/2011 2:47 PM, Daniel Kluev wrote: > On Mon, Apr 25, 2011 at 8:21 AM, 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. > It doesn't. __defaults__ was added in 3.x (and it is documented). > Prior to that, in 2.x, there was func_defaults. > > Jython is not in 3.x yet, so you should not expect 3.x features there. > As for func_defaults, its there and supported as documented: > > Jython 2.5.1+ (Release_2_5_1:exported, Mar 21 2010, 01:00:17) > [Java HotSpot(TM) Server VM (Sun Microsystems Inc.)] on java1.6.0_22 > Type "help", "copyright", "credits" or "license" for more information. >>>> def test(a=123): > ... return a > ... >>>> test() > 123 >>>> test.func_defaults > (123,) >>>> test.func_defaults = (456,) >>>> test() > 456 >