[ase-users] [EXTERNAL] Python3.5 vs 3.6 support
Adam Jackson
a.j.jackson at physics.org
Wed Feb 26 12:52:48 CET 2020
+1 for Python 3.6 here. It has now been available for nearly 5 years and is installed on all the cluster facilities I have recently used.
> > So, insertion-order dicts are considered an "implementation detail" in Python
> > 3.6. It's only an official language feature in Python 3.7+. Practically
> > speaking, this may be a distinction without a difference, but generally I
> > think we ought not to rely on "unofficial" behavior like this.
>
> In our case we are in the clear: We only support CPython, and the
> insertion ordering is now a historical fact of CPython 3.6.
>
> If we supported other Python implementations such as Jython,
> IronPython, or PyPy, it would not have been okay until 3.7.
On the matter of ordered dictionaries, I would suggest using collections.OrderedDict if the ordered behaviour is important. As well as providing compatibility *today* it will make the code easier to understand, especially for any contributors unfamiliar with the new behaviour. Do be aware however that equality comparison between OrderedDicts is sensitive to order, while comparison between 3.6+ dicts is not.
>From the Zen of Python:
> Explicit is better than implicit
-Adam
More information about the ase-users
mailing list