len(ydata) is a bit clearer   (no need to worry about dimension of xdata)