Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Zen of Python #DevCamp01

Zen of Python #DevCamp01

Présentation de la philosophie de développement du langage Python "Zen of Python - PEP 20" pour le premier DevCamp de Rennes à la Cantine Numérique Rennaise.

Florian Strzelecki

October 10, 2012
Tweet

More Decks by Florian Strzelecki

Other Decks in Programming

Transcript

  1. Zen of Python
    DevCamp Rennes #01
    @Exirel

    View full-size slide

  2. I <3 Python
    • « PEP 8 » - Guido van Rossum
    • « PEP 20 - Zen of Python » - Tim Peters
    • « Python for Human » - Kenneth Reitz

    View full-size slide

  3. PEP 20
    • beautiful > ugly
    • explicit > implicit
    • simple > complex
    • complex > complicated
    • flat > nested
    • sparse > dense

    View full-size slide

  4. PEP 20
    • readability in count

    View full-size slide

  5. PEP 20
    • if special_cases:
    raise NotEnoughSpecial(
    ‘Never break the rules.’)

    View full-size slide

  6. PEP 20
    • practicality.beats(purity)

    View full-size slide

  7. PEP 20
    • if not explicitly_silenced:
    raise Exception(‘Shout out errors!’)
    else:
    pass

    View full-size slide

  8. PEP 20
    • with ambiguity:
    raise RefuseToGuess(‘Never guess!’)

    View full-size slide

  9. PEP 20
    • if idea is simple_to_explain:
    print(‘May be it\’s ok.’)
    • if idea is hard_to_explain:
    raise BadIdea(‘Too complicated.’)

    View full-size slide

  10. MAKE IT SIMPLE

    View full-size slide

  11. MAKE IT BETTER

    View full-size slide

  12. MAKE IT PYTHON

    View full-size slide

  13. return ‘Merci’

    View full-size slide