[pypy-dev] question about read only attributes of my file object

Armin Rigo arigo at tunes.org
Sun Dec 5 15:48:35 CET 2004


Hi Laura,

On Sat, Dec 04, 2004 at 06:48:51PM +0100, Laura Creighton wrote:
> So I need to _file.seek() and _file.write() and friends lead to the appropriate
> method on whatever we have set fd to be and I don't know how to do this without 
> redefining __getattr__ to be getattr(self.fd, attr)

Right... Actually I believe that it would be useful to manually export on the
'file' class only the attributes and methods of self.fd that officially exist.  
At least that would be coherent with the point of view that 'file' instances
should have only the official attributes.  In this case, you have to define a
bunch of wrapper methods and properties to access the underlying self.fd
attribute's methods and attributes.

But this could also be regarded as overkill...  I'm not sure I care too much
one way or another.


Armin



More information about the Pypy-dev mailing list