Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #3962

Re: Function __defaults__

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!feeder.news-service.com!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <dan.kluev@gmail.com>
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; 'bug': 0.02; '3.x': 0.09; 'demonstrates': 0.09; 'subject:Function': 0.09; '>>>': 0.12; '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; 'jython': 0.16; 'obscure': 0.16; 'test()': 0.16; 'header:In-Reply-To:1': 0.22; 'mon,': 0.22; '(and': 0.22; 'ken': 0.23; 'platforms.': 0.23; 'received:209.85.214.174': 0.23; 'received:mail-iw0-f174.google.com': 0.23; "didn't": 0.25; 'point,': 0.25; 'expect': 0.26; 'there.': 0.26; 'message- id:@mail.gmail.com': 0.28; 'testing': 0.28; 'server': 0.29; 'daniel': 0.29; 'skip:( 20': 0.31; 'argue': 0.31; 'to:addr:python- list': 0.32; 'idea': 0.32; 'test': 0.33; 'there': 0.35; 'purposes': 0.35; 'that,': 0.35; 'yet,': 0.35; 'think': 0.36; 'case,': 0.36; 'should': 0.37; 'received:209.85': 0.37; 'apr': 0.38; 'received:google.com': 0.38; 'received:209.85.214': 0.39; 'to:addr:python.org': 0.39; 'received:209': 0.39; 'would': 0.40; "it's": 0.40; 'header:Received:5': 0.40; 'best': 0.60; '2011': 0.62; 'mar': 0.64; 'microsystems': 0.84
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:content-type:content-transfer-encoding; bh=k7NY098Nd3TOn8U/O8OjMNMlrb5z5E+R8hgB4HFDfzY=; b=mYXVWYCMLbdO273YBt7KyP6Fu4LGWELs2CUk/yBOsPZTmV7HJ0kRwoQZvZG2sQG5Rd tFlSM9FY+mYiuA4kYwtvHW+2pmGsWcbjsjn6Uw91ZpJmCDGi1ymeHIBlq66iXOPXinH0 4e7BIzYRAZFstqvs60SZ+BKkZHVwgm7gvToR8=
DomainKey-Signature a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=iR0EdATQrRQXa7W2gfWPPJNHYx9JalXx1+dQryUnJCio9hXF3m+pf52leh+/QE1GQV E//ypkwmZf/I+93jfPwbOgsjytBi2OeYbWkteJppboKAFmNtlYBulWOfkVdDP0TqhYor a8j0syLq+X0ilj62Ydml3/usVCc+4NxOyMILU=
MIME-Version 1.0
In-Reply-To <4DB49473.4000204@seehart.com>
References <4db3f444$0$29978$c3e8da3$5496439d@news.astraweb.com> <BANLkTi=hLzcxEGMtsZiSVGdN4bi4A4DCLw@mail.gmail.com> <4DB49473.4000204@seehart.com>
Date Mon, 25 Apr 2011 08:47:43 +1100
Subject Re: Function __defaults__
From Daniel Kluev <dan.kluev@gmail.com>
To python-list@python.org
Content-Type text/plain; charset=ISO-8859-1
Content-Transfer-Encoding quoted-printable
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.803.1303681671.9059.python-list@python.org> (permalink)
Lines 32
NNTP-Posting-Host 82.94.164.166
X-Trace 1303681671 news.xs4all.nl 81482 [::ffff:82.94.164.166]:55447
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:3962

Show key headers only | View raw


On Mon, Apr 25, 2011 at 8:21 AM, Ken Seehart <ken@seehart.com> 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

-- 
With best regards,
Daniel Kluev

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Function __defaults__ Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-04-24 09:58 +0000
  Re: Function __defaults__ Terry Reedy <tjreedy@udel.edu> - 2011-04-24 12:48 -0400
  Re: Function __defaults__ Benjamin Kaplan <benjamin.kaplan@case.edu> - 2011-04-24 13:02 -0400
  Re: Function __defaults__ Daniel Kluev <dan.kluev@gmail.com> - 2011-04-25 04:18 +1100
  Re: Function __defaults__ Ken Seehart <ken@seehart.com> - 2011-04-24 10:07 -0700
    Re: Function __defaults__ Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-04-25 02:00 +0000
  Re: Function __defaults__ Ken Seehart <ken@seehart.com> - 2011-04-24 14:44 -0700
  Re: Function __defaults__ Daniel Kluev <dan.kluev@gmail.com> - 2011-04-25 08:47 +1100
  Re: Function __defaults__ Terry Reedy <tjreedy@udel.edu> - 2011-04-24 17:53 -0400
  Re: Function __defaults__ Ken Seehart <ken@seehart.com> - 2011-04-24 14:54 -0700
  Re: Function __defaults__ "Colin J. Williams" <cjw@ncf.ca> - 2011-04-25 07:59 -0400
  Re: Function __defaults__ Ken Seehart <ken@seehart.com> - 2011-04-25 05:30 -0700
  Re: Function __defaults__ "Colin J. Williams" <cjw@ncf.ca> - 2011-04-25 10:24 -0400

csiph-web