gratuitous new features in 2.0

Niels Diepeveen niels at endea.demon.nl
Mon Aug 28 12:08:26 EDT 2000


Andrew Dalke schreef:

> I already do that.  print is for interactive mode (just like "import *"),
> debugging and for top-level code which will never be used in a library.
> Everything else takes a file-like object using write.

Much the same here.

> Hmm, there is a problem mixing the two mechanisms.  Some of my code
> just passes the 'write' function/method, and not the file object.  This
> could not be passed to a library expecting a file object for use with
> '>>', at least, not without a wrapper object.

Don't you have that problem already with some of the standard library?

> Allowing '>>' means you
> can have libraries which don't talk to each other very easily.  Unless
> "print >> write_function" checks for the "write" method and if that
> fails, if it's callable.  Ugh.

That would be tricky, because print doesn't only need the .write()
method, but also the .softspace flag. I suppose it could use
write.__self__.softspace or something, but eh...

-- 
Niels Diepeveen
Endea automatisering




More information about the Python-list mailing list