Mahmoud Hashemi added the comment:

Python already has one approach that fails to decode non-bytestrings: the 
.decode() method. 

This is about removing unicode barriers to entry and making the str constructor 
in Python 3 as succinctly useful as possible. There are several problems the 
helper does not solve:

1) Usage-wise, str/unicode is used to turn values into text. From a high-level 
perspective, the content does not change, only the representation format. 
Should this fundamental operation really require type inspection and explicit 
try/except blocks every single time? Or should it just work? sorted() does not 
raise an exception if the values are already sorted, why does str() raise an 
exception when the value is already a str?*

2) By and large, among developers, keyword arguments are viewed as "optional" 
arguments that have defaults which can be overridden. However, that is not the 
case here; str is not simply str(obj, encoding=sys.getdefaultencoding()). 
Explicitly passing the keyword argument breaks the call.

3) The helper does not help promote Python adoption when it must be copied and 
pasted it into new developer's projects. It does not help break down the 
misconception that unicode is a punishing concept to be around in Python.

* This question is posed here rhetorically, but I have gotten variations on it 
from multiple Python developers in training.

----------
versions: +Python 2.7

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

Reply via email to