Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #19674
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder2.enfer-du-nord.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <ian.g.kelly@gmail.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; 'attempting': 0.04; 'cpython': 0.05; 'instance,': 0.05; 'pointer': 0.05; 'warnings': 0.05; 'initialize': 0.07; 'exceptions': 0.09; 'match.': 0.09; 'proximity': 0.09; 'tuple': 0.09; 'api': 0.09; 'am,': 0.12; 'cc:addr:python-list': 0.15; '(aka': 0.16; 'nest': 0.16; 'subject:syntax': 0.16; 'subject:question': 0.16; 'wrote:': 0.16; 'meant': 0.17; 'wed,': 0.17; '>>>': 0.18; '\xa0so': 0.18; 'written': 0.19; 'jan': 0.19; 'cc:no real name:2**0': 0.21; "doesn't": 0.22; 'feb': 0.22; 'header:In-Reply-To:1': 0.22; 'url:dev': 0.23; 'received:74.125.82.174': 0.24; 'cc:2**0': 0.25; 'code': 0.25; 'saying': 0.25; 'pm,': 0.26; 'function': 0.27; 'code,': 0.27; 'raise': 0.28; 'message-id:@mail.gmail.com': 0.28; 'cc:addr:python.org': 0.29; 'booth': 0.30; 'kelly': 0.30; 'tuples': 0.30; 'chris': 0.30; 'least': 0.30; 'does': 0.32; 'tue,': 0.32; 'anything': 0.34; "we're": 0.34; 'nested': 0.34; 'null': 0.34; 'received:74.125.82': 0.34; 'url:python': 0.36; 'similar': 0.36; 'reference': 0.37; 'but': 0.37; 'received:74.125': 0.37; 'received:google.com': 0.37; 'skip:_ 10': 0.37; 'think': 0.38; 'correctly': 0.38; 'url:docs': 0.39; 'url:org': 0.39; 'why': 0.39; 'subject:: ': 0.39; 'carry': 0.62; '31,': 0.64; 'absolutely': 0.98 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type:content-transfer-encoding; bh=18utvSbtDHyJONoCleYQFSH0WbaNogtBXu5FOwfqEkQ=; b=kWIhTc/Mhjv29dCf46yxfjf6sav8SLcOsyM3USsXouoSIaSh1aYpf9ZZGzPc4ZJvFk WECxirj8sf0gCrtknnhw4yFsiyp3cS5yCCvOv/BwoeRD6JWYQpBn1UIloGELfID+G5+h 5/Wp/In+VuRuTbgBI7pOoMlxG3Gc1i+68vh7E= |
| MIME-Version | 1.0 |
| In-Reply-To | <CALwzidnpfV_2mQnv33KfZ_WCqTfwahcWfO1fr6A29dGXG0wJ0Q@mail.gmail.com> |
| References | <mailman.5218.1327946109.27778.python-list@python.org> <Xns9FEBE05D32BCCduncanbooth@127.0.0.1> <CAPTjJmqMBpF8TG341Vnfk8eWT8VJq3EgF-_9dnYeKpnPXxGsgA@mail.gmail.com> <CALwzidnpfV_2mQnv33KfZ_WCqTfwahcWfO1fr6A29dGXG0wJ0Q@mail.gmail.com> |
| From | Ian Kelly <ian.g.kelly@gmail.com> |
| Date | Tue, 31 Jan 2012 18:12:44 -0700 |
| Subject | Re: except clause syntax question |
| To | Chris Angelico <rosuav@gmail.com> |
| Content-Type | text/plain; charset=ISO-8859-1 |
| Content-Transfer-Encoding | quoted-printable |
| Cc | python-list@python.org |
| 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.5277.1328058796.27778.python-list@python.org> (permalink) |
| Lines | 26 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1328058796 news.xs4all.nl 6915 [2001:888:2000:d::a6]:52925 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.python:19674 |
Show key headers only | View raw
On Tue, Jan 31, 2012 at 6:09 PM, Ian Kelly <ian.g.kelly@gmail.com> wrote: > On Tue, Jan 31, 2012 at 5:53 PM, Chris Angelico <rosuav@gmail.com> wrote: >> On Wed, Feb 1, 2012 at 9:03 AM, Duncan Booth >> <duncan.booth@invalid.invalid> wrote: >>> Abitrarily nested tuples of exceptions cannot contain loops so the code >>> simply needs to walk through the tuples until it finds a match. >> >> Is this absolutely guaranteed? The C API for CPython provides: >> (Py2) http://docs.python.org/c-api/tuple.html#PyTuple_SetItem >> (Py3) http://docs.python.org/dev/c-api/tuple.html#PyTuple_SetItem >> >> which doesn't have massive warnings on it saying "USE THIS ONLY TO >> INITIALIZE A TUPLE" (compare, for instance, _PyTuple_Resize which does >> carry a similar warning). Is the assumption then that we're all >> adults, and that mutating a tuple is like passing a null pointer to an >> API function (aka "loaded gun in proximity to foot")? > > I don't know why the docs are written the way that they are, but if > you check the code, you can see that PyTuple_SetItem will raise a > SystemError if the reference count is anything other than 1. So I > think that it is only meant to be used with similar caution and > restraint. Incidentally, I *think* that any correctly written C code attempting to nest a tuple inside itself would make the reference count of the tuple be at least 2 at the time of the call, and so it would fail.
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
except clause syntax question Charles Yeomans <charles@declareSub.com> - 2012-01-30 12:41 -0500
Re: except clause syntax question Mel Wilson <mwilson@the-wire.com> - 2012-01-30 14:15 -0500
Re: except clause syntax question Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-01-31 00:00 +0000
Re: except clause syntax question Devin Jeanpierre <jeanpierreda@gmail.com> - 2012-01-30 19:25 -0500
Re: except clause syntax question Charles Yeomans <charles@declareSub.com> - 2012-01-31 08:57 -0500
Re: except clause syntax question Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-01-31 14:51 +0000
Re: except clause syntax question Charles Yeomans <charles@declareSub.com> - 2012-01-31 11:23 -0500
Re: except clause syntax question Devin Jeanpierre <jeanpierreda@gmail.com> - 2012-01-31 11:38 -0500
Re: except clause syntax question Charles Yeomans <charles@declaresub.com> - 2012-01-31 12:29 -0500
Re: except clause syntax question Ethan Furman <ethan@stoneleaf.us> - 2012-01-31 08:56 -0800
Re: except clause syntax question Terry Reedy <tjreedy@udel.edu> - 2012-01-31 19:12 -0500
Re: except clause syntax question Charles Yeomans <charles@declareSub.com> - 2012-01-31 19:27 -0500
Re: except clause syntax question Mel Wilson <mwilson@the-wire.com> - 2012-01-31 08:24 -0500
Re: except clause syntax question Charles Yeomans <charles@declareSub.com> - 2012-01-31 13:04 -0500
Re: except clause syntax question Duncan Booth <duncan.booth@invalid.invalid> - 2012-01-31 22:03 +0000
Re: except clause syntax question Chris Angelico <rosuav@gmail.com> - 2012-02-01 11:53 +1100
Re: except clause syntax question Mel Wilson <mwilson@the-wire.com> - 2012-01-31 23:39 -0500
Re: except clause syntax question Ian Kelly <ian.g.kelly@gmail.com> - 2012-01-31 18:09 -0700
Re: except clause syntax question Ian Kelly <ian.g.kelly@gmail.com> - 2012-01-31 18:12 -0700
Re: except clause syntax question Chris Angelico <rosuav@gmail.com> - 2012-02-01 13:46 +1100
csiph-web