M.-A. Lemburg wrote:
The .transform() methods would simply check for the corresponding
type combination, ie. str.transform() would check for (str, str).
str.encode() would check for (str, bytes), bytes.decode() for
(bytes, str).

Alternatively, we could just not check the type combinations
at all and only apply the result type check.

Note also that both bytearray and bytes provide decode() methods, and will presumably provide transform() methods, so actual type annotations may not be the best way to go about this.

I'm not sure I understand.

If we went with the approach of checking type annotations on the codec, then would a codec which was only annotated with (bytes, str) on the decode method be usable by bytearray.decode()?

And if we aren't going to check the type annotations before invoking the codec, what's the point in having them at all? Better to leave them out entirely, invoke the relevant method of the named codec and see if we get the right type back.

Cheers,
Nick.

--
Nick Coghlan   |   [EMAIL PROTECTED]   |   Brisbane, Australia
---------------------------------------------------------------
            http://www.boredomandlaziness.org
_______________________________________________
Python-3000 mailing list
Python-3000@python.org
http://mail.python.org/mailman/listinfo/python-3000
Unsubscribe: 
http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com

Reply via email to