<p dir="ltr"><br>
On Jun 14, 2016 8:32 AM, "Joao S. O. Bueno" <<a href="mailto:jsbueno@python.org.br">jsbueno@python.org.br</a>> wrote:<br>
><br>
> On 14 June 2016 at 12:19, Steven D'Aprano <<a href="mailto:steve@pearwood.info">steve@pearwood.info</a>> wrote:<br>
> > Is there<br>
> > a good reason for returning bytes?<br>
><br>
> What about: it returns 0-255 numeric values for each position in  a stream, with<br>
> no clue whatsoever to how those values map to text characters beyond<br>
> the 32-128 range?<br>
><br>
> Maybe base64.decode could take a "encoding" optional parameter - or<br>
> there could  be<br>
> a separate 'decote_to_text" method that would explicitly take a text codec name.<br>
> Otherwise, no, you simply can't take a bunch of bytes and say they<br>
> represent text.<br>
><br>
Although it's not explicit, the question seems to be about the output of encoding (and for symmetry, the input of decoding).  In both of those cases, valid output will consist only of ascii characters.</p>
<p dir="ltr">The input to encoding would have to remain bytes (that's the main purpose of base64... to turn bytes into an ascii string).</p>
<p dir="ltr">-Toshio</p>