[Python-ideas] duck typing for io write methods

Nick Coghlan ncoghlan at gmail.com
Thu Jun 13 15:04:36 CEST 2013


On 13 June 2013 22:46, Wolfgang Maier
<wolfgang.maier at biologie.uni-freiburg.de> wrote:
> ok, that's a nice technical explanation, but is that reasonable behavior?
> Shouldn't Python check first to see if the object defines __bytes__() before
> defaulting to the other options?

It doesn't matter whether it's reasonable at this point, it can't be
changed without breaking backwards compatibility. Those things are
special cased, and it's not worth the hassle of changing it.

Cheers,
Nick.

--
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia


More information about the Python-ideas mailing list