[Python-3000] iostack and Oh Oh

tomer filiba tomerfiliba at gmail.com
Wed Nov 29 18:41:19 CET 2006


Guido:
> Agreed that for the distinction between readable/writable it's pretty
> silly, and probably just encourages LBYL code

no, the point was -- should we use separate StreamReader/StreamWriter
classes, we wouldn't need this querying, the object will fail with
AttributeError/TypeError if we attempt to perform an invalid operation.

for example:
f = file("...", "w")
f.read() # IOError

fr = FileWriter(file("...", "w"))
fr.read() # AttributeError

with all that stricter-interfaces talk, which is likely to enter py3k,
the question we should ask is do we want the new IO stack to make
use of those (or at least be designed with that in mind)?

if we do want stricter interfaces in the IO stack too, then we
should follow the java-style path (separate readers and writers,
etc.).

for example, do you think users of the IO stack would want multiple
dispatch based on different streams? i'm well aware that GFs
are not yet finalized material, but do we want to take them into
account? or keep the plain old duck-typed io stack of today?


-tomer


More information about the Python-3000 mailing list