[PATCH 7 of 9] url.py: Remove 'file' inheritance in the httpsendfile class

Renato Cunha renatoc at gmail.com
Thu Jul 1 20:39:51 CDT 2010


(Looks like I forgot to reply to the list...)

On Thu, Jul 01, 2010 at 07:18:48PM -0400, Greg Ward wrote:
> There's nothing wrong with importing __builtin__ at module level.
> It's not like there's a __builtin__.py file somewhere on disk that has
> to be read and parsed!

Ok.

> A fairly common and highly Pythonic idiom for method delegation is to
> do this in the constructor:
> 
>   self.read = self._data.read
>   self.write = self._data.write
>   [...etc...]
> 
> It's less code, it's faster (one less cycle of method lookup/call),
> and it's blindingly obvious that you're just delegating a bunch of
> methods to a wrapped object.  No need to go inspect all those
> delegates to make sure they don't play any funny games.

Doh! True, thanks for your comments.
-- 
Renato Cunha <http://renatocunha.com>
Blog: http://valedotrovao.com
There's no silver bullet.


More information about the Mercurial-devel mailing list