Insert a dictionary into a dictionary?

I am working on building an auto-complete for readline. What I have works, but it's static.

I want it to be able to prompt me based on file contents.

Although I knew it wouldn't work, here's what I tried:
dict in dict
What I want is the output of this function to be part of the dictionary at the place called out with the arrow above:
quit dicting around
For reference, this is how the readline completer is coded:
I'll show you my dict() if you show me yours.
LVL 32
DrDamnitAsked:
Who is Participating?
 
Gerwin Jansen, EE MVEConnect With a Mentor Topic Advisor Commented:
What is the error you get and what it the output you get from loadSites()?

This is working:

>>> def loadS():
...   return {'d':None, 'e':None}
...
>>> loadS()
{'e': None, 'd': None}
>>> LOGIC = {
...   'cm': {},
...   'show': {
...     'sites':loadS(),
...     'config':None
...   }
... }
>>> LOGIC
{'cm': {}, 'show': {'config': None, 'sites': {'e': None, 'd': None}}}
>>>

Open in new window

0
 
DrDamnitAuthor Commented:
Error is:
dict() error
Code is:
dict() 'ing around
0
 
DrDamnitAuthor Commented:
Figured it out. I was trying to pass a dict as a key instead of a value.

For future PAQers...

super dict()
0
 
Gerwin Jansen, EE MVETopic Advisor Commented:
OK, thanks for feedback ;)
0
All Courses

From novice to tech pro — start learning today.