bobf is sharing code with you

Bitbucket is a code hosting site. Unlimited public and private repositories. Free for small teams.

Don't show this again

bobf / cusswords

curses API that sucks less than curses

Clone this repository (size: 21.4 KB): HTTPS / SSH
hg clone https://bitbucket.org/bobf/cusswords
hg clone ssh://hg@bitbucket.org/bobf/cusswords
hg clone https://bitbucket.org/bobf/cusswords/wiki

Style Guidelines

Classes "FooBar" Functions "fooBar" Variables "foo_bar"

Please use a trailing-whitespace detection script for your editor to help you remove it from files.

Keep functions short and simple - no more than 20 lines if possible.

Give functions sensible names.

Comment as little as possible - write clear and clean code that explains what it does by itself, in a short, well-named function. If you're doing something very strange (but necessary, e.g. monkeypatching broken stdlib code) or something that cannot be clearly expressed, write a comment, such as "# XXX: Doing something insane". Keep the comment clear and concise too.

Functions/methods not intended to be a part of the public API should be preceded with a single underscore.

Indent 4 spaces.

Never exceed 80 columns.

Do not reuse variable names in the same function when changing their type, e.g. "foo = "10"; foo = int(10)"

Use keyword parameters if functions receive more than two arguments (use common sense on this one).

Don't return more than two values from a function (again apply common sense).

No lambdas, unless it really does make the code clearer, which is probably never.

NEVER EVER EVER "from foo import *"

Just don't be a dick. Write code that you want people to understand, not code that you want people to be impressed by.

This revision is from 2009-06-29 21:46