News for hackers. Stuff that matters.
Re:Python Best Practice Patterns by atrk on Friday February 28, 2014 @12:41PM (#7320224)
Several of these are generally applicable to programming:

* Keep functions small and composable

* Keep functions at a consistent level of abstraction

* Use constructors to ensure objects always exist in a complete, usable state

* Use meaningful method names in place of comments

It is nice to see that other people struggle with functions with lots of parameters + lots of partial state variables. I don't suppose anyone here has a better solution?

Re:Python Best Practice Patterns by collyw on Friday February 28, 2014 @12:51PM (#7320290)
Comments should explain why you are doing something while method names are a guide to what they are doing. I see them as for different purposes and one should not replace the other.
Re:Python Best Practice Patterns by mercurial on Friday February 28, 2014 @05:07PM (#7321876)
Absolutely, unless you're writing end-user documentation.
Re:Python Best Practice Patterns by collyw on Friday February 28, 2014 @12:55PM (#7320309)
I was playing about in Django recently, having written previous views as functions, I wrote some new ones as class based views. I felt that the OOP approach kept it cleaner and inheritance could be used in the same way as currying could for the function based views (but less complex - maybe because I understand OOP concepts better).