Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #16600

Re: Python 2 or 3

References <O3hCq.1112$Ci1.79@uutiset.elisa.fi> <jbe2jt$v0c$1@dough.gmane.org>
Date 2011-12-04 13:52 +1100
Subject Re: Python 2 or 3
From Chris Angelico <rosuav@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.3257.1322967146.27778.python-list@python.org> (permalink)

Show all headers | View raw


On Sun, Dec 4, 2011 at 7:59 AM, Gelonida N <gelonida@gmail.com> wrote:
> if you write code nicely enough in python 2, then you can translate it
>  to python 3. autmatically.

It's entirely possible to write code that can run on both Python 2 and
Python 3  - at least, if you can target 2.6/2.7 and get the
appropriate future directives. Add in a few exception-guarded imports
for the renamed modules, and then all you're left with is a few things
where you can take a little care while coding, run it through both
versions to test, and have it all work.

ChrisA

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Python 2 or 3 Antti J Ylikoski <antti.ylikoski@tkk.fi> - 2011-12-03 05:54 +0200
  Re: Python 2 or 3 Gnarlodious <gnarlodious@gmail.com> - 2011-12-02 20:10 -0800
  Re: Python 2 or 3 Andrew Berg <bahamutzero8825@gmail.com> - 2011-12-02 22:20 -0600
  Re: Python 2 or 3 Roy Smith <roy@panix.com> - 2011-12-02 23:27 -0500
  Re: Python 2 or 3 Dan Stromberg <drsalists@gmail.com> - 2011-12-02 20:42 -0800
  Re: Python 2 or 3 Terry Reedy <tjreedy@udel.edu> - 2011-12-03 01:23 -0500
  Re: Python 2 or 3 Andrew Berg <bahamutzero8825@gmail.com> - 2011-12-03 00:37 -0600
  Re: Python 2 or 3 Andrew Berg <bahamutzero8825@gmail.com> - 2011-12-03 00:41 -0600
  Re: Python 2 or 3 jmfauth <wxjmfauth@gmail.com> - 2011-12-03 00:59 -0800
  Re: Python 2 or 3 Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-12-03 10:04 +0000
    Re: Python 2 or 3 Chris Angelico <rosuav@gmail.com> - 2011-12-03 21:44 +1100
  Re: Python 2 or 3 Arnaud Delobelle <arnodel@gmail.com> - 2011-12-03 12:03 +0000
  Re: Python 2 or 3 Gelonida N <gelonida@gmail.com> - 2011-12-03 21:59 +0100
  Re: Python 2 or 3 Chris Angelico <rosuav@gmail.com> - 2011-12-04 13:52 +1100
  Re: Python 2 or 3 Terry Reedy <tjreedy@udel.edu> - 2011-12-03 21:52 -0500
  Re: Python 2 or 3 Chris Angelico <rosuav@gmail.com> - 2011-12-04 14:02 +1100
  Re: Python 2 or 3 Zaphod <zaphod@beeblebrox.net> - 2011-12-04 20:18 +0000
  Re: Python 2 or 3 Tobiah <tobiah@teranews.com> - 2011-12-06 09:33 -0800
    Re: Python 2 or 3 Enrico 'Henryx' Bianchi <henryx_b@yahoo.it> - 2011-12-10 00:16 +0100
      Re: Python 2 or 3 Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-12-10 00:19 +0000
        Re: Python 2 or 3 Enrico 'Henryx' Bianchi <henryx_b@yahoo.it> - 2011-12-10 12:49 +0100

csiph-web