Python Forum
random.sample raises OverflowError
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
random.sample raises OverflowError
#5
(Jan-29-2020, 06:07 AM)perfringo Wrote: sys.maxsize():

Quote:An integer giving the maximum value a variable of type Py_ssize_t can take. It’s usually 2**31 - 1 on a 32-bit platform and 2**63 - 1 on a 64-bit platform.

Look also at PEP237 - Unifying Long Integers and Integers

Thanks for your help. The documentation of range also explained the problem.

Quote:Ranges containing absolute values larger than sys.maxsize are permitted but some features (such as len()) may raise OverflowError.
Reply


Messages In This Thread
random.sample raises OverflowError - by sky3141 - Jan-28-2020, 06:43 PM
RE: random.sample raises OverflowError - by buran - Jan-28-2020, 07:03 PM
RE: random.sample raises OverflowError - by sky3141 - Jan-29-2020, 04:02 AM
RE: random.sample raises OverflowError - by sky3141 - Jan-29-2020, 10:53 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Sample random, unique string pairs from a list without repetitions walterwhite 1 563 Nov-19-2023, 10:07 PM
Last Post: deanhystad
  random.choices and random.sample azizrasul 5 2,509 Sep-16-2022, 08:10 PM
Last Post: deanhystad
  open(file, 'rb') raises UnicodeDecodeError binnybit 1 2,556 Sep-28-2020, 06:55 AM
Last Post: Gribouillis
  OverflowError: cannot fit 'int' into an index-sized integer vipinv23 2 9,421 Jan-17-2019, 04:08 AM
Last Post: vipinv23

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020