开发者

What version of Python should I use if I'm a new to Python?

开发者 https://www.devze.com 2022-12-17 06:54 出处:网络
If I\'m absolutely new to Python and am literally reading about printing statements to console, variable types, collections, etc:

If I'm absolutely new to Python and am literally reading about printing statements to console, variable types, collections, etc:

What version of Python should I use?

I'm aware that there is an abundan开发者_开发技巧ce of 3rd party libraries for Python 2.6.x, but I'm scared I'll learn some things that won't carry over well into Python 3.

For example, in Python 3 you can use input(), in Python 2 you have to use raw_input().

Thank you very much for the information.


Python 2.6 (and 2.5, 2.4) are what you will find installed on most machines (Linux) and what you will find most code written in. Therefore I'd start with Python 2.6.


It's really going to depend on what you want to do. Generally speaking Python 3 "isn't ready yet", in the sense that few libraries support Python 3. This will end up greatly limiting what you can accomplish with the language as a beginner.

On the other hand, if you think you'll be spending your time on more "pure programming" tasks as you learn your way around, then Python 3 can be a good starting point, since things like strings are wildly different in Python 3.

So, what do you want out of Python right now? Do you want to make useful things? Python 2.x. Do you want to learn about Python for the sake of learning about Python? Python 3.

Here in a year or two, Python 3 will likely start being the default choice. Until then, it's really up to you. But you can be certain that whatever skills in Python you pick up are going to be useful in 2.x and 3. Some important things changed in Python 3, but Python 3 is still Python.


The latest 2.6. Don't worry about 3.x; there isn't that much to learn.


one thread in SO you can take reference. Search SO for more if you have to.

I wouldn't worry too much on function differences. What's more important right now is to learn the language well. Read the documents on Python 3.0 and what's new in its features. When you know what's new, you will know what to do later on if you require to program in Python 3.0. For 2.6 (not sure about 2.5) , if you require the new print functionality, you can always do from __future__ import print


  1. Python 3 without any doubt. Today (1 Jan, 2020), the official support for Python 2.7 ends completely - https://github.com/python/devguide/pull/344.

  2. Some major open source projects have committed to stop support Python 2 soon - https://python3statement.org/

  3. If you have some Python 2 code which you want to run with Python 3, here is an official guide - https://docs.python.org/3/howto/pyporting.html

  4. Start with the latest version of Python 3 (currently 3.8.1). Python 3 isn't backward-compatible with Python 2 on purpose because it implements a whole set of new features and clears up the clutter in Python 2 which wasn't really adding anything to the language - https://docs.python.org/release/3.8.1/whatsnew/3.0.html


Start with Python3. See http://diveintopython3.org/ for a great introduction.


#python IRC Channel says:

It's too early to use Python 3.x

If you are a beginner I would suggest start learning with Python 2.6


Directly from python.org:

If you don't know which version to use, start with Python 2.6.4; more existing third party software is compatible with Python 2 than Python 3 right now.

If Guido is recommending it, I'd follow him :)

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号