Jason and Mateusz have each posted about Python bindings for FDO this morning, and so I took a look into it. I've been intrigued by FDO ever since I heard of it in October of 2005. Python is my bread and butter, and I'm sad to say that the FDO Python bindings are disappointing.
This, in particular:
oProperties.Release()
almost made me cry like the man in the classic anti-littering PSA. Python has garbage collection. Don't abuse your users. They shouldn't have to explicitly free memory allocated for objects.
Thanks to SWIG, the Python bindings are a literal translation of the C++ API, excruciatingly verbose and explicit, and annoyingly un-Pythonic. The developers need to learn about Python patterns and protocols, and implement them. As I mentioned in Jason's blog, factory methods like:
>>> schema = FdoFeatureSchema.Create(sSchemaName, sSchemaName)
need to be changed to the familiar form:
>>> schema = FdoFeatureSchema(sSchemaName, sSchemaName)
That's how it's done in Python. Any other way is needlessly confusing. Implementing Python's mapping protocol would let users write:
>>> sewer_pipe = classes["SewerPipe"]
in the natural Python way instead of:
>>> oClass = oClasses.FindItem("SewerPipe")