Message350967
> 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. |
|
Date |
User |
Action |
Args |
2019-09-02 01:47:10 | bkline | set | recipients:
+ bkline, xtreak |
2019-09-02 01:47:10 | bkline | set | messageid: <1567388830.64.0.437230512616.issue38003@roundup.psfhosted.org> |
2019-09-02 01:47:10 | bkline | link | issue38003 messages |
2019-09-02 01:47:10 | bkline | create | |
|