Welcome to the Pycom forum Forum
    • \[\[global:header.categories\]\]
    • \[\[global:header.recent\]\]
    • \[\[global:header.tags\]\]
    • \[\[global:header.popular\]\]
    • Login

    Explore Pybytes | Official Documentation | Report a Firmware Bug/Issue | GitHub

    Enable OrderedDict support by default

    Scheduled Pinned Locked Moved Enhancements
    micropythonucollectionsordereddict
    5 Posts 4 Posters 1.5k Views 4 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • D Offline
      DvdGiessen
      last edited by DvdGiessen

      (Hoping this is the right place to suggest this.)

      Support for the OrderedDict type was implemented in MicroPython a few years back, as part of the ucollections module. It doesn't seem to be enabled by default on the Pycom firmware versions. (The other data structure provided by this module, namedtuple, is available on Pycom firmware.)

      Implementation is already there, see https://github.com/pycom/pycom-micropython/search?q=OrderedDict&type=commits. Enabling by default would involve flipping MICROPY_PY_COLLECTIONS_ORDEREDDICT to 1 and probably updating tests (official MicroPython repo has some tests which don't seem to appear in the Pycom tree, yet).

      robert-hhR D 2 Replies Last reply Reply Quote 0
      • robert-hhR Offline
        robert-hh @DvdGiessen
        last edited by

        @DvdGiessen If you set up the build environment for pycom-micropython, you can easily add that yourself by adding the following line to esp32/mpconfigport.h:
        #define MICROPY_PY_COLLECTIONS_ORDEREDDICT (1)

        D 1 Reply Last reply Reply Quote 0
        • T Offline
          TravisT
          last edited by

          Is there a reason why this was left out, besides just saving space?

          1 Reply Last reply Reply Quote 0
          • D Offline
            DvdGiessen @robert-hh
            last edited by

            @robert-hh I'm aware, that why I mentioned that flag. I was suggesting it be enabled by default in PyCom's firmware releases. :)

            1 Reply Last reply Reply Quote 1
            • D Offline
              d.alvrzx @DvdGiessen
              last edited by

              @DvdGiessen coming to this several years later. Seems still not enabled in 1.20.2.rc6 firmware because still getting an ImportError when running from ucollections import OrderedDict :(

              1 Reply Last reply Reply Quote 0

              Hello! It looks like you're interested in this conversation, but you don't have an account yet.

              Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

              With your input, this post could be even better 💗

              Register Login
              • 1 / 1
              • First post
                Last post

              Pycom on Twitter

              Pycom