Python discussed in Nature

Chris Angelico rosuav at gmail.com
Thu Feb 12 10:59:47 EST 2015


On Fri, Feb 13, 2015 at 1:39 AM, Marko Rauhamaa <marko at pacujo.net> wrote:
> Fabien <fabien.maussion at gmail.com>:
>
>> But this was exactly my point! Today in 2015 it's incredibly easy to
>> write py2/py3 code for a scientist. The whole SciPy track has done the
>> transition. Not an issue anymore either, for me at least (python
>> youngster ;-)
>
> I write both Py2 and Py3 code, but I keep the two worlds hermetically
> separated from each other.

One of my students wrote some code for Python 3, and when I went to
test it, I typed 'python scriptname' out of habit (most of my students
use Py2)... and it almost perfectly worked. The only part that didn't
was a class definition that didn't explicitly subclass object, and
then used @property. Just changing that class declaration would have
made his code 2/3 compatible - and he didn't put any effort into it at
all. He literally made his code *accidentally*
(almost-)Py2-compatible.

You don't need to be afraid of the gap.

ChrisA



More information about the Python-list mailing list