Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #3961
| 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!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <ken@seehart.com> |
| 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; 'sep': 0.07; 'used.': 0.07; 'written.': 0.07; 'python': 0.07; '3.x': 0.09; 'attribute': 0.09; 'callable': 0.09; 'subject:Function': 0.09; 'tuple': 0.09; 'url:dev': 0.09; 'writable': 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; '2.5.1': 0.16; '2.5.2': 0.16; 'attributes:': 0.16; 'benjamin': 0.16; 'concur': 0.16; 'defaults,': 0.16; 'jython': 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; 'url:html)': 0.16; 'argument': 0.16; 'ignore': 0.16; 'header :In-Reply-To:1': 0.22; 'mon,': 0.22; 'specified': 0.22; 'values': 0.23; 'ken': 0.23; 'correct': 0.26; 'daniel': 0.29; 'skip:( 20': 0.31; 'points': 0.31; "skip:' 10": 0.32; 'to:addr:python-list': 0.32; '...': 0.32; 'url:docs': 0.33; 'received:192.168.1': 0.34; 'received:192': 0.34; 'correctly': 0.35; 'print': 0.35; 'header :User-Agent:1': 0.35; 'implies': 0.35; 'feature': 0.36; 'none': 0.36; 'received:192.168': 0.37; 'should': 0.37; 'url:python': 0.37; 'apr': 0.38; 'url:org': 0.38; 'to:addr:python.org': 0.39; 'works': 0.40; 'containing': 0.40; '2011': 0.62; 'mar': 0.64; 'safe': 0.65; 'special': 0.66; 'blind': 0.84; 'microsystems': 0.84; 'open,': 0.91 |
| Date | Sun, 24 Apr 2011 14:44:58 -0700 |
| From | Ken Seehart <ken@seehart.com> |
| 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> <BANLkTik4pVW+M_9b8ZFRwLS_L9w2QSMKNg@mail.gmail.com> |
| In-Reply-To | <BANLkTik4pVW+M_9b8ZFRwLS_L9w2QSMKNg@mail.gmail.com> |
| 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 <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.802.1303681500.9059.python-list@python.org> (permalink) |
| Lines | 52 |
| NNTP-Posting-Host | 82.94.164.166 |
| X-Trace | 1303681500 news.xs4all.nl 81475 [::ffff:82.94.164.166]:53663 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.python:3961 |
Show key headers only | View raw
Oops, I must correct myself. Please ignore my previous post. As Daniel points out, Writable is specified in the Python 3 documentation. Apparently I was reading the documentation with only my right eye open, and the Writable tag fell on my blind spot. I concur that this unambiguously implies that the attribute should work as advertised after being written. This is not a bug in Jython. As Daniel points out the attribute was renamed from func_defaults to __defaults__ in python 3. Jython 2.5.2 (Release_2_5_2:7206, Mar 2 2011, 23:12:06) [Java HotSpot(TM) Client VM (Sun Microsystems Inc.)] on java1.6.0_24 Type "help", "copyright", "credits" or "license" for more information. >>> def foo(x=4): ... print x ... >>> foo() 4 >>> foo.func_defaults (4,) >>> foo.func_defaults = (3,) >>> foo() 3 >>> So it works correctly in Jython 2.x. Conclusion: Not an implementation detail, and safe to use. Ken On 4/24/2011 10:18 AM, Daniel Kluev wrote: > http://docs.python.org/dev/reference/datamodel.html > Callable types > ... > Special attributes: > ... > __defaults__ A tuple containing default argument values for those > arguments that have defaults, or None if no arguments have a default > value Writable > > I don't see any 'implementation detail' mark there, and 'Writable' > IMHO means it can be used. > > On Mon, Apr 25, 2011 at 4:02 AM, Benjamin Kaplan > <benjamin.kaplan@case.edu> wrote: >> Jython 2.5.1 (Release_2_5_1:6813, Sep 26 2009, 13:47:54) > In 2.x it was func_defaults (http://docs.python.org/reference/datamodel.html) > __defaults__ is 3.x feature >
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar
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