Tutorial for Python - Should I use 2.x or 3.0? [closed]

Python 3.0 is in beta with a final release coming shortly. Obviously it will take some significant time for general adoption and for it to eventually replace 2.x.

I am writing a tutorial about certain aspects of programming Python. I'm wondering if I should do it in Python 2.x or 3.0? (not that the difference is huge)

a 2.x tutorial is probably more useful now, but it would be nice to start producing 3.0 tutorials.

anyone have thoughts?

(of course I could do both, but I would prefer to do one or the other)


Asked by: Alissa159 | Posted: 24-09-2021






Answer 1

Start with 2.x. Most existing libraries will be on 2.x for a long time. Last year, Guido himself said that it would be "two years" until you needed to learn 3.0; there's still another year left. Personally, I think it will be longer. People writing code on 2.x can learn how to use the 2to3 tool and have code that works on both versions. There is no 3to2, so code written for python 3 is significantly less valuable.

Thats not to mention how disappointing it will be for your students to learn that python 3 is not installed on their Linux computer ("/usr/bin/python" will be python 2.x for the next 5 years, at least), that there is no django for python 3, no wxwindows for python 3, no GTK for python 3, no Twisted for python 3, no PIL for python 3... the real strength of Python has always been in its extensive collection of libraries, and there are very few libraries for python 3 right now.

If your tutorial is well written, you should easily be able to update it to python 2.6, 2.7, and eventually python 3.

Answered by: Sawyer426 | Posted: 25-10-2021



Answer 2

Van Rossum (creator of python) explains that "if you're starting a brand new thing, you should use 3.0." So most people looking to get started should even START with 3.0. It will be useful especially since there are probably very few out there now.

the article

Answered by: Lyndon695 | Posted: 25-10-2021



Answer 3

Learn Python 3.0, as contagious suggests.

Python 2.x is not very different, there seems to be a great deal of FUD about the rather minor differences between them. Sure, the differences are great enough that most programs will need to be modified, but almost all of the modifications are straightforward (like changing print statement to print function).

In fact, Python 2.6 can optionally enable all the new syntactic features of Python 3.0. It's a very well-thought-out transition process.

Answered by: Maria505 | Posted: 25-10-2021



Answer 4

Python 2.x has been out long enough to build up quite a few tutorials already, but 3k has much less resources available. Some intro level 3k stuff would probably see more general purpose use. So unless you're tailoring this to a specific sub domain that lacks any python resources, 3k would be of greater use.

Answered by: Chester502 | Posted: 25-10-2021



Answer 5

It depends on your audience. If it's a general audience, and you plan to leave it posted for a long time, I'd suggest looking forward and going with 3.0. On the other hand if it's for a project or group that's going to be doing work in the near future, Python 2 probably make more sense.

Answered by: John612 | Posted: 25-10-2021



Answer 6

The differences are small enough that it's really not going to matter much.

Answered by: Julia892 | Posted: 25-10-2021



Similar questions

python - Django logs: any tutorial to log to a file

I am working with a django project, I haven't started. The developed working on the project left. During the knowledge transfer, it was told to me that all the events are logged to the database. I don't find the database interface useful to search for logs and sometimes they don't even log(I might be wrong). I want to know, if there is an easy tutorial that explains how to enable logging in Django with minimal configuratio...


python - OAuth 2.0 Tutorial?

Closed. This question does not meet Stack Overflow guid...


python - Need help with Django tutorial

I'm doing the Django tutorial here: http://docs.djangoproject.com/en/1.2/intro/tutorial03/ My TEMPLATE_DIRS in the settings.py looks like this: TEMPLATE_DIRS = ( "/webapp2/templates/" "/webapp2/templates/polls" # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates". # Al...


why am i getting a python indent error here in the django sample tutorial

i have this code from the django sample tutorial from django.db import models from datetime import datetime # Create your models here. class Poll(models.Model): question = models.CharField(max_length=200) pub_date = models.DateTimeField('date published') def __unicode__(self): return self.question ...


python - PyGTK tutorial error?

I'm working with Python 2.7 and PyGTK 2.24. I am working with the following tutorial. Please read it for code context. http://www.pygtk.org/pygtk2tutorial/sec-PackingDemonstrationProgram.html The bottom block of code (reprinted below) is throwing the following error when I type it in (verbatum):


python - Error following django tutorial

I'm trying to follow the django tutorial but I get this error and I can't continue. http://dpaste.com/630957/ Can someone help me? (I'm new with python and django) Thank you so much.


python - Import error in the django tutorial

I'm trying to follow the django tutorial and create two tables where the unique key of table1 might appear several times on table2 (which has a different unique key) CREATE TABLE "apples" ( "id1" integer NOT NULL PRIMARY KEY, "value1" varchar(400) NOT NULL, ) ; CREATE TABLE "oranges" ( "id2" integer NOT NULL PRIMARY KEY, "id1" integer NOT NULL REFERENCES "MyApp_apples" ("id"), "value2" d...


python - Django Tutorial Part 1 'Poll' object doesn't change

I'm new to Django with its tutorial -part 1 : Write your first app. when I want to see my Poll objects in python shell with this command Poll.objects.all(), I see [<Poll: Poll object>], however I've changed my models.py and added class Poll(models.Model): def __unicode__...


python - Fail to run Celery tutorial

Here is the tasks.py from celery.task import task @task def add(x, y): return x + y Here is the celeryconfig.py print 'importing ' + __file__ BROKER_URL = "amqp://guest:guest@localhost:5672//" CELERY_RESULT_BACKEND = "amqp" CELERY_IMPORTS = ("tasks", ) Here is the file that i run. tasks.py: from tasks import add result = add.delay(4, ...


python - Good PyQt tutorial needed


What's the best online tutorial for starting with Spring Python

Closed. This question does not meet Stack Overflow guid...


pdb palm - Any tutorial for Python PalmDB library?

I've downloaded the Python PalmDB lib, but can't find any info on how to use it. I've tried reading docstrings and so far I've been able to come up with the following code: from pprint import pprint from PalmDB.PalmDatabase import PalmDatabase pdb = PalmDatabase() with open('testdb.pdb','rb') as data: pdb.fromByteArr...


Newbie needs help with Python Tutorial

I am a newbie going through a byte of python (3.0). This is the first programming language I have ever used. I am stuck at the point where you make a simple program that creates a backup zip file (p.75). I'm running Windows 7 (64 bit) with python 3.1. Prior to this I installed GNUWin32 + sources, and added C:\Program Files(x86)\GnuWin32\bin to my Path enviornmental variable. This is the program: #!C:\Python...


python - Django logs: any tutorial to log to a file

I am working with a django project, I haven't started. The developed working on the project left. During the knowledge transfer, it was told to me that all the events are logged to the database. I don't find the database interface useful to search for logs and sometimes they don't even log(I might be wrong). I want to know, if there is an easy tutorial that explains how to enable logging in Django with minimal configuratio...


python - Error when following along with the tutorial on the Django website

I am following the django tutorial here. I have copied everything exactly. After the part where you enter the python manage.py sql polls command, it returns: Error:App with the label polls could not be found. Are you sure yuor INSTALLED_APPS setting is correct? I have the site installed in /home...


python - Flash video record on website tutorial


python - OAuth 2.0 Tutorial?

Closed. This question does not meet Stack Overflow guid...


python - Is this a problem with the Django tutorial or a package problem, or is it me?

I'm using Ubuntu 10, python 2.6.5 I'm following this tutorial: http://www.djangobook.com/en/2.0/chapter02 I followed all of the steps using cut-and-paste. The following directory structure was automatically created: bill@ed-desktop:~/projects$ ls -l mysite total 36 -rw-r--r-- 1 bill bill 0 2010-09-01 08:18...


python - Running Django tutorial example with mod_wsgi?

I installed wsgi (mod_wsgi), and could run the simple application by calling http://localhost/myapp. WSGIScriptAlias /myapp /Library/WebServer/Documents/wsgi/scripts/myapp.wsgi def application(environ, start_response): status = '200 OK' output = 'Hello World! WSGI working perfectly!' response_headers = [('Content-type', 'text/pl...


Python GTK "Getting started" tutorial problem

I have a problem with compiling a basic and really simple example of PyGTK usage listed on pygtk's website. This is the first example from this site: http://www.pygtk.org/pygtk2tutorial/ch-GettingStarted.html My code looks like this: #!/usr/bin/env python # example gtk.py import pygtk pygtk.require('2.0...






Still can't find your answer? Check out these communities...



PySlackers | Full Stack Python | NHS Python | Pythonist Cafe | Hacker Earth | Discord Python



top