On Fri, Feb 13, 2015 at 3:56 AM, Marko Rauhamaa <ma...@pacujo.net> wrote:
> $ python3
> Python 3.4.1 (default, Nov  3 2014, 14:38:10)
> [GCC 4.9.1 20140930 (Red Hat 4.9.1-11)] on linux
> Type "help", "copyright", "credits" or "license" for more information.
>>>> import sys
>>>> sys.path = [ '/usr/lib64/python2.7' ] + sys.path

Interesting for intellectual curiosity, but not particularly
significant. All you prove is that the 2.7 stdlib is designed for
compatibility with older 2.x Pythons (or, looking the other way,
nobody wants pointless code churn in working code).

The best way to write 2/3 compatible code is to write 3.x code first.
Then just adhere to a few simple rules (eg always subclass object),
and the bulk of your code will work just fine. You might need to toss
in some explicit __future__ directives (print_function if you don't
stick to "exactly one string argument to print", and division if you
don't want to have to worry about the differences), and if you do this
a lot, you might want to pick up the 'six' library or equivalent, but
other than that, there's really not much to deal with.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to