3 ms·
I've been using 3.6 for some personal work and man are f-strings and ordered dicts wonderful. I don't want to go back.
by xapata 10y ago
I've been using 3.6 for some personal work and man are f-strings and ordered dicts wonderful. I don't want to go back.
- renesd 10y ago1_000_000 times this.
- TylerE 10y agoOrderedDict is just a stdlib import away in Py2.7.
- xapata 10y agoYeah, but... those are ugly. ``m = {}`` is beautiful.
- Macha 10y agodict == OrderedDict is a cpython implementation detail. Not doing the import is just leaving a footgun for yourself if you ever decide to try PyPy or VOC or similar.
- rspeer 10y agoI don't think it's much of a footgun, and I don't think it's limited to CPython. In Python 3.6, kwargs are ordered. In all versions of Python, kwargs are a dict. Therefore, in any implementation of Python 3.6, dicts are ordered. The dev team has stopped short of promising that dicts are ordered, but I can't see how one would realistically be harmed by assuming it to be true.
- xapata 10y agoThe 3.6 CPython dict item storage algorithm was implemented in PyPy first.