Skip to content

Comment on Dependency Injection for Python

Comments

Implicit class bindings sound like a really bad idea and hard to debug.

  Pinject creates implicit bindings for classes.
  The implicit bindings assume your code follows PEP8
  conventions: your classes are named in CamelCase, and
  your args are named in lower_with_underscores. Pinject
  transforms class names to injectable arg names by
  lowercasing words and connecting them with underscores.
  It will also ignore any leading underscore on the class
  name.

  If two classes map to the same arg name, whether those
  classes are in the same module or different modules,
  Pinject will not create an implicit binding for that arg
  name (though it will not raise an error).
AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.