Friday, March 14, 2003

Python Coding Standards

Bill Bumgarner links to a post describing Yahoo’s Python coding guidelines. As he points out, they suggest an Objective-C–inspired naming convention for methods. It looks a little funny, since the selector and arguments aren’t intermixed, but it has the advantage of better interaction with dumb auto-completion.

I really like the Objective-C messaging syntax, especially when combined with Apple’s naming conventions. When you have an NSMutableArray, there is absolutely no ambiguity between -addObject: and -addObjectsFromArray:. In Python, I still confuse append() and extend(), perhaps because in Lisp append is for appending the elements of a list, whereas in Python it’s for appending an object.

Comments RSS · Twitter

Leave a Comment