3 ms·
Many of the language and library developments of the last several years of Python have been in making the language better at expressing concepts and control flo
by jacobolus 16y ago
Many of the language and library developments of the last several years of Python have been in making the language better at expressing concepts and control flow in terms of functions which pass around simple data types, which tends to make code less object-y.
For example: context managers and decorators make it easier to change code behavior in a region of code or a function body; generators make it easier to iterate through collections of things in a declarative way, storing state without explicitly adding it to an object; named tuple objects help in creating simple data types without resorting to heavily customized objects.
Personally, I find in Python that objects are a good and fairly intuitive way to describe data structures or anything needing many similar copies with complex stored state but where each copy is performing some particular action: e.g. representing the users logged into a chat server.
- bad_user 16y agoIf only they added anonymous code blocks.