3 ms·
var['string'] means get the item of object var with key 'string'. Any Python class can define the magic method __getitem__ to define the behavior of/overload th
by cgriswald 8y ago
var['string'] means get the item of object var with key 'string'. Any Python class can define the magic method __getitem__ to define the behavior of/overload the [] operator.
- NightlyDev 8y agoThanks! Didn't know python had magic functions so I was really confused.