Skip to content

Player Code Python Style Guide

Nick Winter edited this page Oct 20, 2016 · 2 revisions

We're teaching people Python. Therefore it is important that we have a consistent and clear coding style that is as close to standard Python as possible. Every Artisan should apply this coding standard in her levels to keep the code through all the levels consistent.

Just basically follow PEP 8, but with these exceptions:

Formatting

  • Try to keep lines to 60 characters or less. (We are working with very narrow code editors sometimes.)
  • Use double quotes.
  • Put placeholder pass statements at the end of empty blocks.

Code style

  • Use camelCase, not snake_case, for compatibility with CodeCombat APIs.

Function and variable naming

  • Avoid single letter names. Be descriptive with your naming.
  • Event handler functions should be prefixed with the word on, like onPetSpawn
Clone this wiki locally