Re:Mercurial’s journey to and reflections on Python 3
by cjbillington on Tuesday January 14, 2020 @02:34AM
(#22042660)
I've found myself defining `native_str = bytes if PY2 else str` (with `if PY2: str = unicode` at the top of the file, as in all my py2/py3 polyglot code) because there are some things that need bytes on Python 2 and unicode on Python 3 - e.g. the `__file__` attribute of a dynamically created module or other low-level things.
[ Parent
| on HN ]
There are no comments on this comment yet.