Showing posts with label best practice. Show all posts
Showing posts with label best practice. Show all posts

Jun 20, 2012

Multiple Inheritance Best Practices

Multiple inheritance should be avoided: It can be replaced with some
design patterns.
  • super usage has to be consistent: In a class hierarchy, super should be used everywhere or nowhere. Mixing super and classic calls is a confusing practice. People tend to avoid super, for their code to be more explicit.
  • Don't mix old-style and new-style classes: Having a code base with both results in a varying MRO behavior.
  • Class hierarchy has to be looked over when a parent class is called: To avoid any problems, every time a parent class is called, a quick glance at the involved MRO (with __mro__) has to be done.

Dec 23, 2011

Requests: HTTP for Humans

Очень юзабельное приложение http://docs.python-requests.org/en/latest/index.html

И не менее красивый код https://github.com/kennethreitz/requests/blob/develop/requests/ Есть чему поучиться