Dynamic legends


I'm using dynamic legends but Legend doesn't seem to be able to handle empty
I know that I could just refuse to do an empty legend, but I still would
call this behaviour a bug:

from pylab import *

t = arange(0.1, 4, 0.1)
s = exp(-t)
e = 0.1*abs(randn(len(s)))
l0, errlines0 = errorbar(t, s, e, fmt="bo-")
l1, errlines1 = errorbar(t, s+1, e, fmt="ro-")
xlabel("Distance (m)")
ylabel("Height (m)")
title("Mean and standard error as a function of distance")
legend([], [])


Traceback (most recent call last):
  File "test.py", line 12, in ?
    legend([], [])
  File "C:\PROGRA~1\python23\Lib\site-packages\matplotlib\pylab.py", line
2315, in legend
    ret = gca().legend(*args, **kwargs)
  File "C:\PROGRA~1\python23\Lib\site-packages\matplotlib\axes.py", line
2044, in legend
    self.legend_ = Legend(self, handles, labels, loc, **kwargs)
  File "C:\PROGRA~1\python23\Lib\site-packages\matplotlib\legend.py", line
181, in __init__
    left, top = self.texts[-1].get_position()
IndexError: list index out of range

This shouldn't be the case - right?