Contribute to Django - Python 3 or Python 2

69 views
Skip to first unread message

premdjango

unread,
Jun 28, 2016, 7:45:02 PM6/28/16
to Django users
Hello,
Im trying to contribute to Django project and started with this document.


Here in couple of places I see Python3 is being used but in most places python2 is used.

Should I use Python 3 or Python 2?


Farhan Khan

unread,
Jun 28, 2016, 9:09:06 PM6/28/16
to Django users
I switched from Python2 to Python3 because I needed my Django code to fire off some TLSv1.2 code, that python2 could not do. I barely notice the difference between the two except in very small syntax differences. When I switched from python2 to python3, I literally did this:

find ./ -name "*.py" -exec 2to3 -w {} \;

And everything worked :)

I found it to have a more profound impact in other frameworks, such as Twisted or any type of socket programming, where you need to worry about encoding/decoding between unicode and binary strings.

Tim Graham

unread,
Jun 28, 2016, 9:13:10 PM6/28/16
to Django users
You can use either, but use Python 3. You can rely on the continuous integration server to test your pull request on Python 2 and debug any issues

Can you given an example of "most places python2 is used"? In fact, the tutorial says, "This tutorial assumes you are using Python 3."


On Tuesday, June 28, 2016 at 7:45:02 PM UTC-4, premdjango wrote:

Ricardo Daniel Quiroga

unread,
Jun 30, 2016, 12:37:31 PM6/30/16
to django...@googlegroups.com

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/a0539448-0019-40a2-b732-e2c44799877b%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--

Ricardo Daniel Quiroga

ludovic coues

unread,
Jul 1, 2016, 6:08:19 AM7/1/16
to django...@googlegroups.com
https://docs.djangoproject.com/en/dev/releases/1.11/

"The Django 1.11.x series is the last to support Python 2. The next
major release, Django 2.0, will only support Python 3.5+."

But your point remains valid.
It make more sense to use python 3 as it will be the only option
available soon and some feature are already python 3 only, like
unicode support in username.
> https://groups.google.com/d/msgid/django-users/CAO2-wHa0Onh2Ng03sHUDOJAcz3BkLGASkWAkDcJkkF7U884GoA%40mail.gmail.com.
>
> For more options, visit https://groups.google.com/d/optout.



--

Cordialement, Coues Ludovic
+336 148 743 42

manikos

unread,
Jul 2, 2016, 8:25:28 AM7/2/16
to Django users
+1 to all the above about using python 3. If I was contributing to Django I would definetely go with python 3. It's the future.

premdjango

unread,
Jul 2, 2016, 10:04:31 AM7/2/16
to Django users
Tim - 
The reason I said its used in most of the places is because - 

for example:

pip install -e /path/to/your/local/clone/django/

I would expect pip3 install of pip..



On Tuesday, June 28, 2016 at 7:45:02 PM UTC-4, premdjango wrote:

Michal Petrucha

unread,
Jul 2, 2016, 1:53:23 PM7/2/16
to django...@googlegroups.com
On Sat, Jul 02, 2016 at 07:04:31AM -0700, premdjango wrote:
> Tim -
> The reason I said its used in most of the places is because -
>
> for example:
>
> pip install -e /path/to/your/local/clone/django/
>
>
> I would expect pip3 install of pip..

This looks like a bit of a misunderstanding. Using executables called
``pip``, or ``python``, means “use whatever version of Python you have
set as default,” which in some cases will be Python 2, but in other
cases Python 3. If you create your virtualenv or venv using Python
3.5, then running just ``pip`` or ``python`` with that venv activated
will indeed use Python 3.5.

Using ``pip3`` in the docs would be misleading, because it would
indicate that only Python 3 is supported, while you're free to choose
either Python 2 or Python 3 (at least for now).

Of course, many people (myself included) will recommend going with
Python 3, but 2.7 is still a valid choice.

Cheers,

Michal
signature.asc

premdjango

unread,
Jul 2, 2016, 2:27:12 PM7/2/16
to Django users
Thanks Michael, That was the confusion. 
I will go ahead with Python 3.


On Tuesday, June 28, 2016 at 7:45:02 PM UTC-4, premdjango wrote:
Reply all
Reply to author
Forward
0 new messages