[Python-Dev] accept string in a2b and base64?

Antoine Pitrou solipsis at pitrou.net
Tue Feb 21 13:28:07 CET 2012


On Tue, 21 Feb 2012 12:51:08 +1000
Nick Coghlan <ncoghlan at gmail.com> wrote:
> 
> My one concern with the base64 patch is that it doesn't test that
> mixing types triggers TypeError. While this shouldn't require any
> extra code (the error should arise naturally from the method
> implementation), it should still be tested explicitly to ensure type
> mismatches fail as expected.

I don't think mixing types is a concern. The extra parameters to the
base64 functions aren't mixed into the original string, they are used to
modify the decoding algorithm.

So it's like typing `open(b"LICENSE", "r")`: the fast that `b"LICENSE"`
is bytes while `"r"` is str isn't really a problem.

Regards

Antoine.




More information about the Python-Dev mailing list