New to Python ... Python 3 and Matplotlib

I want to learn Python. I have a course in Python 3. However, I will need to use mainly matplotlib and Numpy, and these libraries are not yet compatible with Python 3. Is it worth doing a course in Python 3 or is it a waste of time to learn Python 3 and then return to Python 2 .x?

What would you do?

+7
source share
4 answers

You will not have a problem returning to Python 2.x after learning Python 3 or vice versa. Too many differences. (Some standard changes to the library, printing is a function, all lines are Unicode - you will never notice most of them).

Actually, if you learn Python 3 now and get to work with Python, you will almost certainly be working with Python 2.x right now. Python 3 has not yet become widespread. However, Python 3 will be more adopted in the near future, as several libraries are ported to Python 3.

If you need to use Matplotlib specifically, then you should use Python 2.7 (it makes no sense to use Python 3 right now if you don't need a library). But learning Python 3 at first will by no means lead you to any flaw and may put you ahead of the curve when most people finally make the switch.

There is also nothing stopping you from using both (Python 3 for learning / experimenting, Python 2.7 for working).

+13
source

FYI, Matplotlib is now ported to Python 3 .

+14
source

"What would you do?"

I would port matplotlib to Python 3. :-)

But no, the course in Python 3 was not in vain. The differences are mainly in the standard library and in the subtle internal differences.

The main differences in the language itself: the unicode type is called str in Python 3 and that print is a function. The differences are not so great that the course is wasted.

+4
source

Another way is to use cython , which allows you to create your own python libraries that are compatible (without using 2to3 or 3to2) with both 2.x and 3.x. However, this is a bit of work. You can use set and dict functions with python versions that do not support these functions.

0
source

All Articles