R. David Murray added the comment:

Vis the discussion of x[:0] in the review.  This kind of construct is only 
unfamiliar because it is new in Python3, and there are not *that* many places 
that you want to (and can) deal with both bytes and strings using the same 
code.  But when you can, it is the more-or-less obvious way to write the code.

In this particular case you could also write type(x)().  There are pluses and 
minuses to both forms, but if any of the rest of the code uses slicing to work 
around the fact that byte strings index into ints, then I would definitely 
prefer the slice form.

----------

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

Reply via email to