generalize numpy linspace