Wandering Thoughts archives


Python 3 from the perspective of someone writing new Python code

I've talked about Python 3 from the perspective of a Unix sysadmin and Python 3 from the perspective of someone with existing Python 3 code; now it's time for the final viewpoint, that of someone writing new code.

There are a bunch of practical difficulties with this, things like having Python 3 installed on machines and third party modules being ported to Python 3, but they're either gone or going away (and most of what I write doesn't depend on third party modules). Ignoring those issues as ultimately unimportant, I don't think there's any reason not to write new, non-sysadmin code in Python 3. It's clearly the future of Python and although I may grump about some decisions, there's a fair amount to like about it. Yes it's different but much of that difference is good.

(I've made a vaguely similar transition in Python programming before, when I moved from 1.x to 2.x. It was a more backwards compatible change and I felt it was less wrenching, but it had just the same sort of generally neat new things in the new version. Today, for example, if I write an old-style class it's by accident.)

I have to admit that this is a theoretical view right now, because I haven't tried to write anything new in Python 3 yet. Most of what I've written recently is sysadmin tools and those need to be in Python 2 for the foreseeable future. But the next time I come up with a Python program to write I'm going to keep this in mind and try to write it in Python 3 instead of Python 2, no matter what my inertia is saying.

(A good step would be to make sure that as many of our machines as possible actually have Python 3 installed. Now that I look, some of them don't have it installed by default, which isn't going to help Python 3's adoption any.)

PS: the one Python 3 change that's going to be irritating me for years is the whole Unicode-ification of everything in sight. This deserves a longer discussion than fits within the margins of this entry and besides, this entry is a positive one. Also, I suspect that once I start actually using Python 3, the Unicode stuff will prove to be less of a pain than I currently expect it to be.

python/Python3NewCode written at 03:41:11; Add Comment

These are my WanderingThoughts
(About the blog)

Full index of entries
Recent comments

This is part of CSpace, and is written by ChrisSiebenmann.
Twitter: @thatcks

* * *

Categories: links, linux, programming, python, snark, solaris, spam, sysadmin, tech, unix, web

This is a DWiki.

By day for December 2011: 2 3 4 5 6 7 8 9 10 11 12 13 14 16 17 18 19 20 21 23 24 25 26 27 28 29 30 31; before December; after December.

Page tools: See As Normal.
Login: Password:
Atom Syndication: Recent Pages, Recent Comments.

This dinky wiki is brought to you by the Insane Hackers Guild, Python sub-branch.