On Mon, Dec 3, 2012 at 6:30 PM, Steven D'Aprano
wrote:
> Yeah, in hindsight it was a pretty crappy example. But this sort of
> dynamism really is useful:
>
> def testRaises(exc, func, *args):
> try:
> result = func(*args)
> except exc:
> return
> raise AssertionError("e
On Mon, 03 Dec 2012 16:24:50 +1100, Chris Angelico wrote:
> On Mon, Dec 3, 2012 at 8:31 AM, Steven D'Aprano
> wrote:
>> Consider this piece of legal Python code:
>>
>> Err = None
>> if condition(x) > 100:
>> Err = OneException
>> elif another_condition(x):
>> Err = AnotherException
>> try
On Mon, Dec 3, 2012 at 8:31 AM, Steven D'Aprano
wrote:
> Consider this piece of legal Python code:
>
> Err = None
> if condition(x) > 100:
> Err = OneException
> elif another_condition(x):
> Err = AnotherException
> try:
> spam(a, b, c)
> except Err:
> recover()
Legal it may be, b
On Sun, 02 Dec 2012 12:25:22 -0500, Roy Smith wrote:
> This is kind of weird (Python 2.7.3):
>
> try:
> print "hello"
> except foo:
> print "foo"
>
> prints "hello". The problem (IMHO) is that apparently the except clause
> doesn't get evaluated until after some exception is caught. Wh
On 12/2/2012 12:25 PM, Roy Smith wrote:
This is kind of weird (Python 2.7.3):
try:
print "hello"
except foo:
print "foo"
prints "hello". The problem (IMHO) is that apparently the except clause
doesn't get evaluated until after some exception is caught. Which means
it never notices t
On 2/12/12 18:25:22, Roy Smith wrote:
> This is kind of weird (Python 2.7.3):
>
> try:
> print "hello"
> except foo:
> print "foo"
>
> prints "hello". The problem (IMHO) is that apparently the except clause
> doesn't get evaluated until after some exception is caught. Which means
> it
This is kind of weird (Python 2.7.3):
try:
print "hello"
except foo:
print "foo"
prints "hello". The problem (IMHO) is that apparently the except clause
doesn't get evaluated until after some exception is caught. Which means
it never notices that foo is not defined until it's too late