In a message of Sat, 04 Dec 2004 17:15:24 GMT, Armin Rigo writes:
>Hi Laura,
>
>On Sat, Dec 04, 2004 at 06:07:33PM +0100, Laura Creighton wrote:
>> So -- do you really want me to use the properties? I now think they are
>> icky.
>
>Ick! Yes! People who use __getattr__() or __setattr__() should be shot
>without even waiting for dawn. Basically, they don't cooperate well with
>the whole new-style class mechanisms.
>
>A bientot,
>
>Armin.
But I am still going to need something for __getattr__(), I think.
I mean, in the __init__ I have all of this stuff:
self.fd = sio.DiskFile(name, mode)
if mode in ['U', 'rU']:
# Wants universal newlines
self.fd = sio.TextInputFilter(self.fd)
if bufsize < 0:
bufsize = None
if not self.writing and (bufsize is None or bufsize > 0):
# Read only buffered stream.
self.fd = sio.BufferingInputStream(self.fd, bufsize)
if not self.reading:
if bufsize is None or bufsize > 1:
# Write only buffered stream.
self.fd = sio.BufferingOutputStream(self.fd, bufsize)
elif bufsize == 1:
self.fd = sio.LineBufferingOutputStream(self.fd)
if self.reading and self.writing:
if bufsize > 2:
# Read and write buffered stream.
self.fd = sio.BufferingInputOutputStream(self.fd, bufsize)
return self.fd
---------
which basically exists to get self.fd set to the proper stream.
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)
So looks as if I am shot before dawn no matter what :-) Better make my
last meal memorable...
Laura
_______________________________________________
[EMAIL PROTECTED]
http://codespeak.net/mailman/listinfo/pypy-dev