= Divmod Coding Standard = Divmod uses [http://twistedmatrix.com/trac/browser/trunk/doc/development/policy/coding-standard.xhtml?format=raw the Twisted coding standard]. In addition, we are trying to make certain aspects of the Twisted coding standard stricter. For example: * There should be 3 blank lines between module-level suites, such as classes and top-level functions. * There should be 2 blank lines between class-level suites, such as methods. * Within a class, the ordering of the elements is: 1. docstring 1. {{{implements()}}} 1. class attributes 1. Python special methods, starting with {{{__new__}}} if present, then {{{__init__}}}. 1. Methods part of no interface 1. Methods implementing an interface, grouped by interface, prefixed with a comment like this: {{{ #!python # IYourInterface }}} * Be careful with code like: {{{ #!python def test(): outer1, outer2 = something() class Stub(object): foo = frob(outer1) def bar(self): return outer2 }}} Due to [http://bugs.python.org/issue1569356 a bug] in Python ≤ 2.5, when run with tracing (such as `trial --coverage`), the closed bindings (`outer1`, `outer2`) leak into the class context, causing problems when they have special meaning there.[[BR]] Vulnerable names should be renamed to avoid conflict. Vulnerable ''values'' require wrapping in an indirect reference, such as: {{{ #!python class Foo(formless.TypedInterface): pass _indirectFoo = lambda: Foo class Bar(formless.TypedInterface): baz = formless.Object(interface=_indirectFoo()) }}} See also #2394.