Stream interfaces
Topmind
topmind at technologist.com
Tue Feb 27 15:07:13 EST 2001
[quote]
Steam
PeekableStream
PositionableStream
ExternalStream
BufferedExternalStream
ExternalReadStream
ExternalReadWriteStream
ExternalWriteStream
InternalStream
WriteStream
ReadWriteStream
[end quote]
I admit that I am not an expert on streams, but this
hierarchy seams tree-happy to me.
Why not have something like this instead:
s = newStream(....)
s.peekable = true
s.positionable = false
s.external = blah
s.buffered = blah
s.readAble = true
s.writeAble = true
[use the stream now.....]
(Note that the dot syntax could be a
dictionary instead of an object, BTW.
Also note that these would have *defaults*
so that not every setting needs to be
explicitly set.)
This setup is much easier to manage and grok IMO. It also allows *more*
potential combinations, like buffered internal streams. (I can't think of
why anybody would want such, but why limit the future to one's
current lack of imagination. Perhaps they want to test buffering
locally.)
I want to flatten GUI's and Collections in a similar way.
Flatten flatten flatten!
-flatmind-
(But I am not flat-footed. I have a very prominent arch.)
More information about the Python-list
mailing list