by bgilroy26 · 11y ago · 0 comments
But Python3 is mostly just Python2 with a print function instead of a print keyword. It is occasionally non-trivial to port large existing code bases from Python2 to Python3, but it is practically always trivial for a Python2 programmer to write new code in Python3.
I hope Perl 6 will get its own camel book!
I imagine its relevance to the Perl 6 that was announced today is next to nil.
Until you need to use some library that doesn't support python3. I think I've made the transition from python3 to python2 more than I have the other way around.
More and more of the bigger libraries are ported already, and a lot of the others have been replaced by newer libraries that work with Python 3. If the library you're trying to use doesn't support Python 3, it's probably a good indication most people have moved on to something better...
>>> b"%u" % 5
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: unsupported operand type(s) for %: 'bytes' and 'int'json.loads(foo) blahblahException foo is bytes not text.
That said I still endorse py3 for new things
If I remember right, % used to be deprecated in Python 3, but was undeprecated again by popular demand.
: )
I commented because I didn't want the top comment to devolve into a Perl v. Python argument because I love both.
Looking at my comment now, it doesn't read as on topic.
Thank you for moderating. HN is my favorite place to read the news!
What ends up becoming off-topic on HN, btw, is as much about upvotes and replies as it is about the original comment.
There's a pretty big page of changes, rules for maintaining compatibility and suggestions and it pretty much killed all my enthusiasm.
I'm speaking from memory and might be wrong, but one annoying thing was that I couldn't detect the Python version and print an error message, instead the P2 interpreter would throw an error at runtime when encountering a P3 construct.
There are many nice P3 books and libraries, but 2 vs 3 is still a PITA.
If there is a operator in Perl 6, which you don't have in Python- Your options are to rewrite those semantics in Python most of them pretty large, and they won't be easy to read either.
Ease of learning is a irrelevant metric. You can't use a needle to replace a saw, if you do you are only going to end up doing more work.
> Ease of learning is a irrelevant metric. You can't use a needle to replace a saw, if you do you are only going to end up doing more work.
I adore the elegance of your wording.