Pythonic code review (Red Hat Security Blog)
Over at the Red Hat Security Blog, Ilya Etingof writes about code reviews, in general, along with some specific thoughts on Pythonic versus non-Pythonic idioms in code. "People coming from Java tend to turn everything into a class. That's probably because Java heavily enforces the OOP paradigm. Python programmers enjoy a freedom of picking a programming model that is best suited for the task.The choice of object-based implementations look reasonable to me when there is a clear abstraction for the task being solved. Statefulness and duck-typed objects are another strong reason for going the OOP way.If the author's priority is to keep related functions together, pushing them to a class is an option to consider. Such classes may never need instantiation, though.Free-standing functions are easy to grasp, concise and light. When a function does not cause side-effects, it's also good for functional programming."