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

Martin Geisler mg at aragost.com
Wed Jun 30 06:08:46 CDT 2010


Renato Cunha <renatoc at gmail.com> writes:

> On Mon, Jun 28, 2010 at 04:38:56PM -0300, Renato Cunha wrote:
>> +        if attr == '_data':
>> +            return self._data
>
> Clearly[1], this part is not necessary, please ignore it in your review.

While reading this, I came to think that we probably only need to define
a few methods in order for httpsendfile to be sufficiently file-like.
Perhaps a write and read method? I think something like

  def write(self, str):
    return self._data.write(str)

  def read(size=None):
    return self._data.read(size)

is clearer than __getattr__ magic, especially when you (as far as I can
see) also begin making wrappers for methods.

-- 
Martin Geisler

aragost Trifork
Professional Mercurial support
http://aragost.com/mercurial/


More information about the Mercurial-devel mailing list