Python discussed in Nature

Marko Rauhamaa marko at pacujo.net
Thu Feb 12 11:56:46 EST 2015


Chris Angelico <rosuav at gmail.com>:

> On Fri, Feb 13, 2015 at 1:39 AM, Marko Rauhamaa <marko at pacujo.net> wrote:
>> I write both Py2 and Py3 code, but I keep the two worlds hermetically
>> separated from each other.
>
> [...]
>
> You don't need to be afraid of the gap.

No problem. When I write Py3, I write Py3. When I write Py2, I write
Py2. When I write bash, I write bash. When I write C, I write C.

Who's afraid of the Big Bad Wolf:

========================================================================
$ 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
>>> import re
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib64/python2.7/re.py", line 240
    raise TypeError, "first argument must be string or compiled pattern"
                   ^
SyntaxError: invalid syntax
>>> import xmllib
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib64/python2.7/xmllib.py", line 813
    print 'xml: encoding =',encoding,'standalone =',standalone
                          ^
SyntaxError: invalid syntax
========================================================================


Marko



More information about the Python-list mailing list