Mailing List Archive


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[tlug] Python 2x3 [was: Um, so... systemd?]



Darren Cook writes:

 > Meanwhile I've spent a lot more time the past couple of months
 > trying to work out if I'm writing code that will work in both
 > Python 2.7 and 3.x :-)

I really can't recommend doing that any more.  There remain good
reasons for sticking to 2.7 for consultants working with existing
codebases, but most new code (and I mean >50% but increasing steadily)
is now being written in Python 3, and most libraries have Python
3-compatible versions.  Many applications require Python >= 3.4.
There are already even people out there saying "I'm not interested in
working in anything less than Python 3.6,"[1] which is like two weeks
old.  You're really screwing yourself and likely more than half your
clients restricting yourself to 2.7-compatible code.

Bottom line: If you're going to write code for 2.7, just write it for
2.7, hold the line at bug fixes and security features (2.7 itself
doesn't even get bug fixes any more), and write a separate version for
3.x going forward.

Of course you know your business, and you may have no clients on 3.x
for x > 3 where the pain of abstaining from 3-only features starts to
be noticable (1 broken ribby, 2 broken ribby), but be aware that the
pain is likely to be unbearable (7 broken ribby, several in more than
one place) in a year and a half when 3.7 comes out and many people are
actually using 3.6 in production.


Footnotes: 
[1]  This is still a little unusual, stemming from a combination of
the generic goodness of f-strings, which allow you to write string
expressions that take their value from the context namespace rather
than as method invocation arguments, and the rather esoteric new async
stuff, which makes it much easier to write robust event-driven or
coroutine-based servers (or evil code that nobody knows how it works).



Home | Main Index | Thread Index

Home Page Mailing List Linux and Japan TLUG Members Links