Re: [Tutor] Pattern to handle exceptions

2005-09-23 Thread Kent Johnson
Negroup - wrote: > Hi all, I have a question about the following lines of code: > > class Foo: > > ... bar = 'bar' > ... > # is it better this def te(attribute): > > ... try: > ... print getattr(c, attribute) > ... except AttributeError: > ... re

[Tutor] Pattern to handle exceptions

2005-09-23 Thread Negroup -
Hi all, I have a question about the following lines of code: >>> class Foo: ... bar = 'bar' ... >>> # is it better this >>> def te(attribute): ... try: ... print getattr(c, attribute) ... except AttributeError: ... return None >>> # >>> # or this? >>> def h_a(at