[issue9873] Allow bytes in some APIs that use string literals internally
Nick Coghlan
report at bugs.python.org
Thu Sep 30 13:40:49 CEST 2010
Nick Coghlan <ncoghlan at gmail.com> added the comment:
Yeah, the general implementation concept I'm thinking of going with for option 2 will use a few helper functions:
url, coerced_to_str = _coerce_to_str(url)
if coerced_to_str:
param = _force_to_str(param) # as appropriate
...
return _undo_coercion(result, coerced_to_str)
The first helper function standardises the typecheck, the second one complains if it is given something that is already a string.
The last one just standardises the check to see if the coercion needs to be undone, and actually undoing the coercion.
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue9873>
_______________________________________
More information about the Python-bugs-list
mailing list