# Style Guide

De officiële stijlgids voor Python-code is PEP 8 (opens new window).

# Encoding

Goed

Gebruik UTF-8.

# Indenteren

Indenteer met 4 spaties per indenteringsniveau.

Goed

while True:
    action = input('? ')
1
2

Fout

while True:
  action = input('? ')
1
2

# Line Break

Linebreaks voor de binaire operator.

Goed

print(1
      + 2)
1
2

Fout

print(1 +
      2)
1
2

# Imports

Een lijn per import.

Goed

import datetime
import random
1
2

Fout

import datetime, random
1

# Bronnen

© 2024 Arteveldehogeschool Laatst bijgewerkt: 14/2/2020, 11:07:52