[merge] http multirange support

Andrew Bennetts andrew at canonical.com
Tue Jul 18 09:29:21 BST 2006


On Tue, Jul 18, 2006 at 06:16:08PM +1000, Martin Pool wrote:
> On 13 Jul 2006, John Arbash Meinel <john at arbash-meinel.com> wrote:
[...]
> > +        tell = getattr(data, 'tell', None)
> > +        if tell is None:
> > +            return StringIO(data.read())
> > +        return data
> 
> Why not just do 'if not hasattr'...?

I don't know if this is John's reason, but one big disadvantage of hasattr is
that it swallows all exceptions, such as KeyboardInterrupt (and silently converts
them to a return value of False).

It's a pretty minor issue for things that are normal attributes, but for
instance in the ZODB world it's a major problem because attribute access can
cause an ConflictError, which is a very bad thing to ignore.

I'm not sure it's a significant concern for bzr, but the issue with hasattr is
enough that some people never use it just in case.

-Andrew.





More information about the bazaar mailing list