[merge] [trivial] tell developers not to use hasattr()
Robert Collins
robertc at robertcollins.net
Fri Nov 16 01:45:41 GMT 2007
On Wed, 2007-11-14 at 20:15 -0800, Martin Pool wrote:
>
> +General Python rules
> +--------------------
> +
> +``hasattr`` should not be used because it swallows exceptions
> including
> +``KeyboardInterrupt``. Instead, say something like ::
> +
> + if getattr(thing, 'name', None) is None
We have code grep tests, perhaps hasattr should be in there?
-Rob
--
GPG key available at: <http://www.robertcollins.net/keys.txt>.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20071116/c98c35fa/attachment.pgp
More information about the bazaar
mailing list