Chennaipy met again on the 28th of January. There were about 6 members this time. Despite the low turn out we had a great time.
The meeting started off with the AlphaBubbles talk by Siva Chandran. Siva started off with a demo of his program. The program randomly generated bubbles, that floated down to the bottom, accumulated and then bursted off. Siva then showed us the components used to build the program - pymunk and pygame. pymunk is a Python wrapper for a 2D physics engine called Chipmunk. The physics engine is what that made the floating bubbles look realistic. He then walked us through code and showed us how to use the pymunk API.
The code for AlphaBubbles is available from https://github.com/sivachandran/AlphaBubbles
The next talks was on XML Processing with Python by Vijay. The talk was about the ElementTree API introduced in Python 2.5, plus the lxml specific API. Vijay started by comparing ElementTree with DOM, and said that ElementTree was more Pythonic. He then described the Element object which represents a node in the ElementTree. The attributes are available as a dictionary. The child elements are available as a list of Elements.
He took a sample file, and showed how the various elements and attributes can be accessed, using the ElementTree API. He then showed the lxml specific ETXPath object, and how it can be used to evaluate XPath expressions.
As planned we played the "API Design anti-patterns" talk by Alex Martelli. Though the talk was good, it was an advanced talk. A not so complete list of things he discussed was:
The situation in which there is no API. Examples are website that do not provide an RPC API. People resort to web scraping. Even a minor change in the page layout will cause the application to fail.
The situation in which the API is not designed. Examples are internal functions and objects that are exposed, without any design or forethought. When the internals change the applications using the API break.
The situation in which there are too many APIs. He showed how the API can instead be layered as low level and high level APIs.
The situation in which the API is not consistent. The naming convention of classes, for example - HTTPConnection, HttpHandler.
His slides are available at www.aleax.it/pycon11_adap.pdf