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
-
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 ? -
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.
-
@defrance_a Split your dict in several shorter lines.
d = {'a':1,'b':2} d2 = {'c':3,'d':4} d.update(d2) print(d)
-
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.