[Python-ideas] duck typing for io write methods

Wolfgang Maier wolfgang.maier at biologie.uni-freiburg.de
Thu Jun 13 10:50:21 CEST 2013


Dear all,
currently - and referring to Python 3 - the write methods of the different
io module objects work on bytes and str objects only. The built-in functions
print() and bytes(), on the other hand, use an arbitrary object's __str__
and __bytes__ methods to compute the str and bytes they should work with.
Wouldn't it be more consistent and pythonic if the io write methods behaved
the same way?
Best,
Wolfgang



More information about the Python-ideas mailing list