Files
freezer-dr/HACKING.rst
jacky06 a3ba38b2f8 Sync Sphinx requirement
1. Sync sphinx dependency with global requirements. It caps python 2 since
sphinx 2.0 no longer supports Python 2.7.
2. Fix RST syntax in HACKING.rst
3. Update moved URLs in README.rst

Change-Id: I74bfead9b1962ad9c5e9eb2f7ab79022566085c9
2019-08-03 11:53:24 +02:00

958 B

Freezer DR Style Commandments

Freezer DR Specific Commandments

Logging

Use the common logging module, and ensure you getLogger:

from oslo_log import log

LOG = log.getLogger(__name__)

LOG.debug('Foobar')

Properly Calling Callables

Methods, functions and classes can specify optional parameters (with default values) using Python's keyword arg syntax. When providing a value to such a callable we prefer that the call also uses keyword arg syntax. For example:

def f(required, optional=None):
    pass

# GOOD
f(0, optional=True)

# BAD
f(0, True)

This gives us the flexibility to re-order arguments and more importantly to add new required arguments. It's also more explicit and easier to read.