Skip to content

Code Style

Giselle Martel edited this page Jan 15, 2021 · 1 revision

Basic rules:

  • Ivadomed follows PEP8 style guidelines
  • Right margin is set to 120 characters

Line-wrapping convention example:

from module import foo, bar, \
    baz, quux

long_expression = component_one + component_two + component_three + component_four + component_five + component_six

# for function definition, align with opening delimiter
def xyzzy(long_parameter_1,
          long_parameter_2):
    pass

# for calling a function, both conventions below are acceptable
xyzzy('long_string_constant1',
      'long_string_constant2')

xyzzy(
    'with',
    'hanging',
    'indent'
    )

attrs = [e.attr for e in
         items]

ingredients = [
    'green',
    'eggs',
    ]

if True:
    pass

try:
    pass
finally:
    pass