|
From: Matt N. <mno...@ma...> - 2008-02-27 16:34:43
|
Michael Foord wrote: > Matt Nordhoff wrote: >> Hi. >> >> Python's hasattr() function swallows all exceptions, including things >> like KeyboardInterrupt. Therefore, one project I tinker on (Bazaar) uses >> "getattr(object, 'attribute', None) is not None" instead. Here's a patch >> to change that in ConfigObj (and pathutils). >> >> Of course, that is subtly different, so you should verify it's ok. I >> didn't run ConfigObj's test suite (unless it has no output and takes 1 >> second, in which case I did), but I did run Bazaar's test suite with >> this change and nothing broke. >> > > Is the current use of hasattr *actually* causing any problems - or is it > to avoid potential problems? To avoid potential problems. > I can see any problem with the patch though... (not likely to be a new > release *soon* but can apply to SVN). "can" or "can't"? > Michael Foord > http://www.manning.com/foord Hmm, I didn't mean this message to be so terse.. -- |