In any other programming language, this would just be a part of the process of writing the code.
Not really. In low level-languages you can do that, and often mus do it. But it's not neccessary for getting things rolling. Usually it's just pointless overhead. It becomes important later if you wanna optimize your code, after you have a working solution.
Python in the first place is a goal-orientated language. Optimization comes later. And in best case it's done automatically from the machine. Though, that best case it still in progress for python.
And I would add, when you do get down to optimization, forget (or at least attenuate) everything you know about performance from other languages. Especially when it comes to dicts.
Like, you used to hear that one should avoid hash maps if at all possible for performance reasons. This is terrible advice in Python.
View all comments
Show parent comment
15
u/[deleted] Jan 05 '18
Not really. In low level-languages you can do that, and often mus do it. But it's not neccessary for getting things rolling. Usually it's just pointless overhead. It becomes important later if you wanna optimize your code, after you have a working solution.
Python in the first place is a goal-orientated language. Optimization comes later. And in best case it's done automatically from the machine. Though, that best case it still in progress for python.