Pipelines now have a __len__() method.

The length of a pipeline is defined as the length of its command
stack.  This makes it easy to inspect the number of batched commands
and to write conditional logic for empty pipelines.