python 2-3 compatibility and gotchas #451
Comments
It was.
As far as I remember, we are supporting and teaching Python 3. We signed the Python 3 statement which says
As far as I remember, we are requiring/recommend learners to install Python 3 for more than a year. I expect that instructors teach using Python 3 (from their default installation or using a virtual environment) to avoid different output from the learners. |
I think our lessons should be Python 2 compatible and Python 3 compatible. For example, this This can be mitigated easily with a Encourage Python 3, but don't break Python 2 if we don't have to, and warn instructors about gotchas - this feels robust. |
I disagree. When I learnt Fortran I hate that my instructor was enforcing our code to be Fortran 77 compatible.
Realistic, except for significant figures reasons, who does write
If a learner is using Python 2 for what ever reason, they should be aware of the differences between Python 2 and Python 3. Otherwise, we don't need to cover it.
This is the case of
|
Thanks for contributing to the discussion. I definitely agree with @rgaiacs @marwahaha do you mind if I close this issue? |
I believe we should stick to teaching python 3. There are several reasons for this:
|
compatibility
Perhaps this has been previously discussed. It would be great to ensure that all code is compatible with python 2 and python 3. This ensures that the installation version does not hinder the learning. The syntax is similar enough that we should not take a purists' stance here.
gotchas
There are simple things that may confuse instructors used to one version, but the students report a different output. It may be useful to add to the lessons as notes to instructors on some brief/potential gotchas:
print(range(3))
(one prints a list, one doesn't; can be fixed withprint(list(range(3)))
)np_array*2.0
(do you need to multiply by floats in both versions?)print 'hello'
vsprint('hello')
5/2
and integer divisionI used to maintain a list of differences that beginners commonly run into, perhaps we can incorporate some of this: http://python.berkeley.edu/learn/
The text was updated successfully, but these errors were encountered: