Re: [Python-Dev] New/Old class exception pitfall

2008-03-17 Thread Alexander Belopolsky
Oleg Broytmann phd.pp.ru> writes: > > On Mon, Mar 17, 2008 at 06:35:46PM -0400, Alexander Belopolsky wrote: > > class x: > > pass > > class y(x): > > pass > > try: > > raise y > > except y: > > print "a" > > except: > > print "b" > > > > It prints 'b'. > >Python 2.2, 2.3, 2.4 and 2.5

Re: [Python-Dev] New/Old class exception pitfall

2008-03-17 Thread Oleg Broytmann
On Mon, Mar 17, 2008 at 07:18:25PM -0400, Alexander Belopolsky wrote: > I don't have my PowerBook here, but I am sure I've seen in on Mac OS > too. Only new-style class behavior is problematic. The following > code prints 'b' for me: > > __metaclass__ = type Ah, yes - with this addition it

Re: [Python-Dev] New/Old class exception pitfall

2008-03-17 Thread Alexander Belopolsky
On Mon, Mar 17, 2008 at 6:49 PM, Guido van Rossum <[EMAIL PROTECTED]> wrote: .. > Really? Under which version exactly? On which platform? I cannot > reproduce this with either 2.4, 2.5 or 2.6 on OS X. Just retested in Python 2.6a1+ (trunk:61449M, Mar 17 2008, 17:29:21) [GCC 3.4.6 20060404 (Red

Re: [Python-Dev] New/Old class exception pitfall

2008-03-17 Thread Oleg Broytmann
On Mon, Mar 17, 2008 at 06:35:46PM -0400, Alexander Belopolsky wrote: > class x: > pass > class y(x): > pass > try: > raise y > except y: > print "a" > except: > print "b" > > It prints 'b'. Python 2.2, 2.3, 2.4 and 2.5 on Linux: prints 'a'. Oleg. -- Oleg Broytmannhttp:

Re: [Python-Dev] New/Old class exception pitfall

2008-03-17 Thread Guido van Rossum
On Mon, Mar 17, 2008 at 5:35 PM, Alexander Belopolsky <[EMAIL PROTECTED]> wrote: > While discussing issue2291, I presented the following argument: > > """ > Consider the following code: > > class x: > pass > class y(x): > pass > try: > raise y > except y: > print "a" > ex

[Python-Dev] New/Old class exception pitfall

2008-03-17 Thread Alexander Belopolsky
While discussing issue2291, I presented the following argument: """ Consider the following code: class x: pass class y(x): pass try: raise y except y: print "a" except: print "b" It prints 'b'. Now, suppose in preparation for 3.0 transition someone adds "__metaclass__ = type" to the module