0
python dict question: what's behind "{...}"?
trying to play around with dict: >>> dic = {'a':1} >>> dic['b'] = dic >>> print(dic['a']) 1 >>> print(dic) {'a': 1, 'b': {...}} >>> print(dic['b']) {'a': 1, 'b': {...}} so, what's {...}? is it abbrevated list of {'a': 1, 'b': {{'a': 1, 'b': {{'a': 1, 'b': {...}}...}}...}}?
2 Respostas
+ 1
Interesting question. It means that you created an infinite dictionary nested inside itself, which can't be printed. "dic" contains "dic" which contains "dic"... and so on.
The "{...}" notation is a way to let you know this, and to inform that it can't be represented.
Slightly modified answer taken from
https://stackoverflow.com/questions/17160162/
+ 1
thanks Diego! and the link worths clicking!