randrange exceptional behavior
MRAB
python at mrabarnett.plus.com
Mon Oct 24 16:09:16 EDT 2011
More information about the Python-list mailing list
Mon Oct 24 16:09:16 EDT 2011
- Previous message (by thread): randrange exceptional behavior
- Next message (by thread): randrange exceptional behavior
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 24/10/2011 20:26, candide wrote: > Where is documented the behaviour of the standard function randrange in > the case of an empty list ? for instance randrange(42,33) ? May I rely > on an ValueError type error? It's the same back to at least Python 2.5, so you can probably rely on that behaviour. Interestingly, the documentation says: """This is equivalent to choice(range(start, stop, step)), but doesn’t actually build a range object.""" but for choice(seq) it says: """If seq is empty, raises IndexError.""" so it's not entirely equivalent.
- Previous message (by thread): randrange exceptional behavior
- Next message (by thread): randrange exceptional behavior
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list