1. 41

  2. 4

    It feels like we are through the valley of releases that needed to restore Python 2 compatibility. Good to see releases with a few innovations that will make my life easier.

    1. 2

      Some interesting data on Python 2/3 usage and transition (or not):

      1. 4

        I admit I didn’t read through it but only skimmed over the pages, I think they measure open source libraries mostly, and I kind of expect those eto maintain compatibility for a while. Some still do for Python 2.6. So while their data is valid, it doesn’t say much about actual Python applications / serices.

        My subjective take on Python 3 migrations

        • Migration didn’t really happen before Python 3.4. With 3.0 and 3.2 there wasn’t really a “win”, and linux distributions still had Python 2.7 as their default.
        • In the beginning of 2017 I spent a few days getting the CI infrastructure at my then employer (~100 Python devs) into shape. When the docker builds were busy, I spent some time applying python-modernize on a few of the companies shared libraries, then fixing a few remaining issues by hand. It wasn’t much trouble.
        • In 2018 I see more and more Python projects starting off of Python 3.x. When in 2015, developers would have chosen 2.7 if in doubt.

        Oh, and I am still furious about them renaming .iteritems() to .items() instead of at least leaving it as an alias.

    2. 3

      I’m really excited about data classes!

      1. 2

        The insertion-order preservation nature of dict objects is now an official part of the Python language spec.

        My ruby friends will finally stop laughing at me

        Does this mean that OrderedDict will be phased out?

        1. 1

          That’s a great question, I think there’s still a place for OrderedDict. Dict isn’t getting anything beyond the insertion-order guarantee, whereas OrderedDict has a bunch of other things going on like reversed(). There’s some more on this stackoverflow question. Also, there is a pretty interesting mailing list thread that gets into this a little bit, though from the perspective of 3.6 (which introduced some of this).

          1. 1

            I recall perl5 having a feature shuffling hash keys for security reasons. Python2 also had similar problem. So, is that safe?

            1. 2

              That’s a different issue involving forcing hash collisions to trigger pathological run time behavior. This has nothing to do with the hash function, but rather just adds a level of indirection in the storage to save memory. A side effect of that is it’s easy to preserve insertion order.

          2. 1

            Context variables sound good, I really liked them in Racket. UTF-8 is a sane default for IO, so nice on that front too.