str.count is slow

2006-02-27 Thread chrisperkins99
It seems to me that str.count is awfully slow. Is there some reason for this? Evidence: str.count time test import string import time import array s = string.printable * int(1e5) # 10**7 character string a = array.array('c', s) u = unicode(s) RIGHT_ANSWER = s.count('a') def ma

Re: 2.3 -> 2.4: long int too large to convert to int

2005-09-15 Thread chrisperkins99
Grant Edwards wrote: > I give up, how do I make this not fail under 2.4? > > fcntl.ioctl(self.dev.fileno(),0xc0047a80,struct.pack("HBB",0x1c,0x00,0x00)) > > I get an OverflowError: long int too large to convert to int > > ioctl() is expecting a 32-bit integer value, and 0xc0047a80 has > the high-