Great Moments in Library Documentation

I present to you the entire documentation for the GObject.chain() function in the PyGTK library:

gobject.GObject.chain

    def chain(...)

... : additional parameters
Returns : a Python object

The chain() method does something.

So, the function takes some unspecified number of parameters, “does something,” and returns something. (Since everything in Python is an object, saying the function returns an object isn’t particularly informative.)

In other words, pretty much any function you could possibly write can be described by the above documentation.

2 Responses

  1. Does Python have a void-equivalent? I thought Python functions always implicitly returned the last computed value, so basically any function which has any statement at all would have to return something (and even with no statement at all wouldn’t it just be ‘false’ which is in turn an object of boolean type?)

  2. Python’s null-equivalent is None, which is of type NoneType. There’s no (C-style) void-equivalent, since every statement returns a value (and all values are objects); the closest you can come to returning nothing is to return None. Python syntax forbids you from having functions with no statements; the pass statement (Python’s nop), which does nothing and returns None, is typically used for “empty” functions.

    I suppose a hyperliteral reading of the documentation quoted above would require the function to take any number of arguments, so it’d be prototyped something like def chain(self, *args), but even then there’s no telling what the function does or what arguments it wants.

Comments are closed.