On 27 June 2010 18:22, Steve Willoughby <st...@alchemy.com> wrote:
> On 27-Jun-10 10:12, Adam Bark wrote: > >> On 27 June 2010 17:47, Payal <payal-pyt...@scriptkitchen.com >> > > c. What is the correct Python of writing, >> except as e: print 'Msg : ' , e # Capturing all exceptions >> > > Since exceptions are (should be?) subclasses of Exception, you can do: > > except Exception as e: > > > I think the 'as' syntax is only available in Python 3.x >> > > It's in Python 2 as well. At least I see it in 2.6.4, probably earlier too > (but I'm not sure ATM how early it showed up). > > Ah yeah sorry I got confused, it's the comma version that is gone from 3.x isn't it? I assume that means 'as' is the preferred syntax.
_______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor