New submission from Barry A. Warsaw:

This came up at the Pycon 2013 Python 3 porting clinic.  There are many cases 
in the stdlib that claim (either explicitly or implicitly) to accept bytes or 
strings, but that don't return the type of the arguments they accept.  An 
example is urllib.parse.quote() which accepts bytes or str but always returns 
str.  A similar example brought up at the clinic was difflib, which accepts 
both types, and works internally on both, but crashes when joining the results 
for return.

It should be policy for the stdlib (i.e. codified in an informational PEP and 
including bug reports, because they *are* bugs, not features or baked-in API) 
where bytes or str are accepted but the right things are not done (i.e. return 
the type you accept).

This bug captures the principle, and probably should be closed once such a PEP 
is accepted, with individual bugs opened for each individual case.

----------
components: Library (Lib)
messages: 184379
nosy: barry
priority: normal
severity: normal
status: open
title: Return the type you accept
versions: Python 3.2, Python 3.3, Python 3.4

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue17445>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to