Python 3 with backwards compatibility features
Porting Python code from version 2.x to 3.x is not a simple task. To help, I built a version of Python 3.6 that includes backwards compatibility features. Most important is the mixing of bytes and str objects and comparisons. For example, in vanilla Python 3: >>> b'foo' + 'bar' Traceback (most recent call last): File "", line 1, in TypeError: can't concat bytes to str >>> None ", line 1, in TypeError: unorderable types: NoneType() >> b'foo' + 'bar' sys:1: DeprecationWarning: encoding bytes to str 'foobar' >>> None < 'hi' __main__:1: DeprecationWarning: default compare is depreciated True…
What it does
In the maker’s words, at launch
Porting Python code from version 2.x to 3.x is not a simple task. To help, I built a version of Python 3.6 that includes backwards compatibility features. Most important is the mixing of bytes and str objects and comparisons. For example, in vanilla Python 3: >>> b'foo' + 'bar' Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: can't concat bytes to str >>> None < 'hi' Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: unorderable types: NoneType() < str() In my Python 3: >>> b'foo' + 'bar' sys:1: DeprecationWarning: encoding bytes to str 'foobar' >>> None < 'hi' __main__:1: DeprecationWarning: default compare is depreciated True Certain changes are easy to fix with code converters like 2to3. For example, changing print statements into functions is trivial. I don't bother trying to handle those. There is still a lot of things that could be added. However, when porting a large code base to Python 3, I found it useful. I hope other people might use it and submit improvements. If someone need pre-built binaries (e.g. Windows), I would be willing to do it. https://github.com/nascheme/ppython
Does the same job
all alternatives →- PTPython-to-Python compiler for some 3.6 features in older versions2017 · github.com · ▲87
- APA Python with Hindley-Milner-like type annotations, compiling to C2015 · github.com · ▲134
- SRShareable reasons to upgrade to Python 32017 · whypy3.com · ▲62
- IWI wrote a book on Python regular expressions2019 · ▲193
My book titled "Python re(gex)?" is free to download through this weekend [1][2] The book covers both 're' and 'regex' modules, has plenty of examples and chapters also have cheatsheets and exercises. Code snippets, exercises, sample chapters, etc are available on GitHub repo [3] I used pandoc+xelatex [4] to generate the pdf. [1] https://gumroad.com/l/py_regex [2] https://leanpub.com/py_regex [3] https://github.com/learnbyexample/py_regular_expressions [4]…
- ASA Swift implementation of selected parts of Python standard library2014 · github.com · ▲55
- SPSimple Python struct format-string explainer2022 · pythonstruct.com · ▲7
Hi everyone! As a side project I made a tiny static website that helps explain format strings used with Python's `struct` module. Type/paste in a format string and you get a quick explanation of the structure instead of having to look through the docs. It's open source, happy to hear any suggestions how to make it more useful.
More dev tools this month
the category →



Open-source GTM skills for technical founders
Dev tools · 29d ago · gtmcofounder.com

OpenTrailPaper is open-source bike computer firmware for the LilyGO T5S3 4.7" E-Paper PRO. It supports offline maps, GPX routes, FIT recording and Bluetooth sensors.
Dev tools · 1d ago · opentrailpaper.com

Launched alongside, December 2016
the whole month →


Talking face-to-face with your team is just one click away
Work · 2016 · slack.com

Making your resume a piece of cake
Life & fun · 2016 · cake.me

