3 ms·
you need to check if dictionary key exists, else you get an exception when trying to get the keys value. What should be the correct behavior when accessing a k
by dagw 8y ago
you need to check if dictionary key exists, else you get an exception when trying to get the keys value.
What should be the correct behavior when accessing a key that doesn't exists? If you want a specific default value when a key doesn't exist you can use the get() method.
Also ':' at the end of each line.
What do you mean? You don't need ':' at the end of each line, only at the start of a block (basically anywhere you'd use a '{' in other languages).
- blattimwind 8y ago> What should be the correct behavior when accessing a key that doesn't exists? Undefined behaviour, i.e. the JIT generates code to 3D print a clay golem on your desktop that sets your village ablaze.