Mark Dickinson added the comment: > One to make it return a single number if amount == 1 and the other to check > that the amount > 1.
Suggestion: if you want to go that way, return a single number if `amount` is not provided (so make the default value for `amount` None rather than 1). If `amount=1` is explicitly given, a list containing one item should be returned. I also think there's no reason to raise an exception when `amount = 0`: just return an empty list. For comparison, here's NumPy's "uniform" generator, which generates a scalar if the "size" parameter is not given, and an array if "size" is given, even if it's 1. >>> np.random.uniform() 0.4964992470265117 >>> np.random.uniform(size=1) array([ 0.64817717]) >>> np.random.uniform(size=0) array([], dtype=float64) ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue18844> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com