8

I was modifying a dictionary, and accidentally wrote something like

data = dict(a=1, b=2)
if condition:
    data['c']: 3

I expected this to be a syntax error, however it runs correctly, and the statement simply seems to have no effect.

Which makes me curious: what kind of statement is this, and why is this legal?

blue_note
  • 27,712
  • 9
  • 72
  • 90

0 Answers0