Chris Angelico wrote:
> On Wed, Feb 1, 2012 at 9:03 AM, Duncan Booth
> 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) h
On Wed, Feb 1, 2012 at 12:12 PM, Ian Kelly wrote:
> 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.
Good, nice that that's certain :)
Mi
On Tue, Jan 31, 2012 at 6:09 PM, Ian Kelly wrote:
> On Tue, Jan 31, 2012 at 5:53 PM, Chris Angelico wrote:
>> On Wed, Feb 1, 2012 at 9:03 AM, Duncan Booth
>> wrote:
>>> Abitrarily nested tuples of exceptions cannot contain loops so the code
>>> simply needs to walk through the tuples until it fi
On Tue, Jan 31, 2012 at 5:53 PM, Chris Angelico wrote:
> On Wed, Feb 1, 2012 at 9:03 AM, Duncan Booth
> 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
On Wed, Feb 1, 2012 at 9:03 AM, Duncan Booth
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.h
On Jan 31, 2012, at 7:12 PM, Terry Reedy wrote:
> On 1/31/2012 8:57 AM, Charles Yeomans wrote:
>
>> In any case, though I appreciate your attempt at a post hoc justification,
> > I was hoping for a positive explanation.
>
> I think the best you are going to get is that Python somewhat consisten
On 1/31/2012 8:57 AM, Charles Yeomans wrote:
In any case, though I appreciate your attempt at a post hoc justification,
> I was hoping for a positive explanation.
I think the best you are going to get is that Python somewhat
consistently*, for both practical and historical reasons#, uses tupl
Charles Yeomans wrote:
> To catch more than one exception type in an except block, one writes
>
> except (A, B, C) as e:
>
> I'm wondering why it was decided to match tuples, but not lists:
>
> except [A, B, C] as e:
>
> The latter makes more sense semantically to me -- "catch all exception
>
On Jan 31, 2012, at 8:24 AM, Mel Wilson wrote:
> Charles Yeomans wrote:
>
>> To catch more than one exception type in an except block, one writes
>>
>> except (A, B, C) as e:
>>
>> I'm wondering why it was decided to match tuples, but not lists:
>>
>> except [A, B, C] as e:
>>
>> The latter
Charles Yeomans wrote:
On Jan 31, 2012, at 9:51 AM, Steven D'Aprano wrote:
On Tue, 31 Jan 2012 08:57:31 -0500, Charles Yeomans wrote:
I don't think of a tuple as a container, and I don't think it a
misunderstanding on my part to think this.
>>
Well, it is a misunderstanding, because tuples A
On Jan 31, 2012, at 11:38 AM, Devin Jeanpierre wrote:
> On Tue, Jan 31, 2012 at 11:23 AM, Charles Yeomans
> wrote:
>>
>> On Jan 31, 2012, at 9:51 AM, Steven D'Aprano wrote:
>>
>>> On Tue, 31 Jan 2012 08:57:31 -0500, Charles Yeomans wrote:
>>>
I don't think of a tuple as a container, and
On Tue, Jan 31, 2012 at 11:23 AM, Charles Yeomans
wrote:
>
> On Jan 31, 2012, at 9:51 AM, Steven D'Aprano wrote:
>
>> On Tue, 31 Jan 2012 08:57:31 -0500, Charles Yeomans wrote:
>>
>>> I don't think of a tuple as a container, and I don't think it a
>>> misunderstanding on my part to think this.
>>
On Jan 31, 2012, at 9:51 AM, Steven D'Aprano wrote:
> On Tue, 31 Jan 2012 08:57:31 -0500, Charles Yeomans wrote:
>
>> I don't think of a tuple as a container, and I don't think it a
>> misunderstanding on my part to think this.
>
> Well, it is a misunderstanding, because tuples ARE containers.
On Tue, 31 Jan 2012 08:57:31 -0500, Charles Yeomans wrote:
> I don't think of a tuple as a container, and I don't think it a
> misunderstanding on my part to think this.
Well, it is a misunderstanding, because tuples ARE containers. You might
as well say "I don't think of boxes as containers". W
On Jan 30, 2012, at 7:00 PM, Steven D'Aprano wrote:
> On Mon, 30 Jan 2012 12:41:00 -0500, Charles Yeomans wrote:
>
>> To catch more than one exception type in an except block, one writes
>>
>> except (A, B, C) as e:
>>
>> I'm wondering why it was decided to match tuples, but not lists:
>>
>>
Charles Yeomans wrote:
> To catch more than one exception type in an except block, one writes
>
> except (A, B, C) as e:
>
> I'm wondering why it was decided to match tuples, but not lists:
>
> except [A, B, C] as e:
>
> The latter makes more sense semantically to me -- "catch all exception
>
On Mon, Jan 30, 2012 at 7:00 PM, Steven D'Aprano
wrote:
> On Mon, 30 Jan 2012 12:41:00 -0500, Charles Yeomans wrote:
>
>> To catch more than one exception type in an except block, one writes
>>
>> except (A, B, C) as e:
>>
>> I'm wondering why it was decided to match tuples, but not lists:
>>
>> e
On Mon, 30 Jan 2012 12:41:00 -0500, Charles Yeomans wrote:
> To catch more than one exception type in an except block, one writes
>
> except (A, B, C) as e:
>
> I'm wondering why it was decided to match tuples, but not lists:
>
> except [A, B, C] as e:
Simplicity.
If you also allow lists, the
Charles Yeomans wrote:
> To catch more than one exception type in an except block, one writes
>
> except (A, B, C) as e:
>
> I'm wondering why it was decided to match tuples, but not lists:
>
> except [A, B, C] as e:
>
> The latter makes more sense semantically to me -- "catch all exception
>
On Jan 30, 2012, at 12:56 PM, Aaron wrote:
> On 01/30/2012 06:41 PM, Charles Yeomans wrote:
>> To catch more than one exception type in an except block, one writes
>>
>> except (A, B, C) as e:
>>
>> I'm wondering why it was decided to match tuples, but not lists:
>>
>> except [A, B, C] as e:
>
On 01/30/2012 06:41 PM, Charles Yeomans wrote:
To catch more than one exception type in an except block, one writes
except (A, B, C) as e:
I'm wondering why it was decided to match tuples, but not lists:
except [A, B, C] as e:
The latter makes more sense semantically to me -- "catch all excep
To catch more than one exception type in an except block, one writes
except (A, B, C) as e:
I'm wondering why it was decided to match tuples, but not lists:
except [A, B, C] as e:
The latter makes more sense semantically to me -- "catch all exception types in
a list" as opposed to "catch this
22 matches
Mail list logo