[PATCH 1 of 6] blackbox: adds a blackbox extension
Pierre-Yves David
pierre-yves.david at logilab.fr
Tue Feb 12 05:41:18 CST 2013
On Sun, Feb 10, 2013 at 12:09:45PM +0000, Brodie Rao wrote:
> > +
> > + if '_blackbox' in self.__dict__:
>
> This seems like a weird way of checking this (it isn't the case here,
> but Python objects don't always have __dict__). I think you want
> util.safehasattr().
Has Brodie said: DON'T
What you want to check is the existence of 'self._blackbox'. use `util.safehasattr()` (python on is broken)
In the very rare case where you really want to check dict (existence in the local object namespace) use `vars`
"if '_blockbox' in vars(self)"
--
Pierre-Yves David
http://www.logilab.fr/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://selenic.com/pipermail/mercurial-devel/attachments/20130212/3269faaf/attachment.pgp>
More information about the Mercurial-devel
mailing list