omz:forum

    • Register
    • Login
    • Search
    • Recent
    • Popular

    Welcome!

    This is the community forum for my apps Pythonista and Editorial.

    For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.


    Dict limitation

    Pythonista
    dict
    3
    4
    1831
    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.
    • defrance_a
      defrance_a last edited by

      Can’t declare a dict with 1000 keys : the editor of Pythonista can’t load the .py file with the declaration, frozes and quits suddenly…
      Is it a limitation of dict variable or a bug in the editor view ?

      cvp 1 Reply Last reply Reply Quote 0
      • JonB
        JonB last edited by

        The editor has known issues with very large python statements that it needs to apply formatting to.

        one option is to rename to .txt, edit, then rename back to .py to allow importing. rename using python, not using the editor.

        1 Reply Last reply Reply Quote 0
        • cvp
          cvp @defrance_a last edited by cvp

          @defrance_a Split your dict in several shorter lines.

          d = {'a':1,'b':2}
          d2 = {'c':3,'d':4}
          d.update(d2)
          print(d)
          
          1 Reply Last reply Reply Quote 0
          • JonB
            JonB last edited by

            I cant recall if json files have the same limitation; you could save the file as .json or plain text, using a json dict format. Then use json.load to read it into a dict. obviously only works for json compatible types.

            1 Reply Last reply Reply Quote 0
            • First post
              Last post
            Powered by NodeBB Forums | Contributors