Bob Kline <bkl...@rksystems.com> added the comment:

> Use str instead.

Sure. I understand the advantages of the new approach to strings. Which, by the 
way, weren't available when this project began. I don't disagree with anything 
you say in the context of writing new code. I was, however, surprised and 
dismayed to learn of the cavalier approach the upgrade tool has taken to 
silently breaking existing code which it is claiming to "fix."

Here's my favorite so far.

--- cdr.py      (original)
+++ cdr.py      (refactored)
@@ -36,15 +36,15 @@
 # ======================================================================
 from six import itervalues
 try:
-    basestring
+    str
     is_python3 = False
     base64encode = base64.encodestring
     base64decode = base64.decodestring
 except:
     base64encode = base64.encodebytes
     base64decode = base64.decodebytes
-    basestring = (str, bytes)
-    unicode = str
+    str = (str, bytes)
+    str = str
     is_python3 = True

We wrote this following the example of comparable techniques in 
http://python-future.org/compatible_idioms.html and similar guides to an 
upgrade path. Seems we're being punished for taking the trouble to make our 
code work with Python 2 and 3 during the transition period. :-(

It's hard to see how this conversion resulted in something better than what we 
already had.

----------

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

Reply via email to