Re: Availability of Numpy, WX, Matplotlib and Scipy under Python3
On Sep 04, 2012, at 09:00 AM, Nigel Sedgwick wrote:
>Given the issue with (especially) WX, I think I will stick with Python
>2.7 for the time being.
The only suggestion I'd make is that you write your Python 2 code so that it's
easier to port to Python 3 when all your dependencies are available. I'm not
sure how many good guides there are out there on writing Python 3-friendly
Python 2 code, but you might have a look at http://wiki.ubuntu.com/Python/3
for some hints.
I suppose the top recommendations I'd give are:
* Target nothing older than Python 2.6 (2.7 is even better)
* As much as possible, write common idiom code (possibly using the 'six'
library if necessary).
* from __future__ import absolute_import, print_function, unicode_literals
* Get your bytes vs. strings story straight right from the start.
* Use b'' for bytes.
* Avoid idioms you know are gone in Python 3, like backticks, dict.iter*()
methods, xrange(), etc.
Or essentially: write your code as if it were a single code base,
dual-compatible code base. Eventually, it will be even if you end up dropping
Python 2 support at some point. ;)
Cheers,
-Barry
Reply to: