On Wed, 29 Apr 2009 00:36:56 +1000, Li Wang wrote: > Although bin(99)[4] could be used to locate it, this transform cost too > much memory (99 only needs 2Bytes, while string '1100011' needs 7Bytes).
This is Python, not C. Your figures are completely wrong. >>> sys.getsizeof(99) 12 >>> sys.getsizeof('1100011') 31 Everything in Python is an object. If you're expecting C performance for bit-twiddling operations, you aren't going to get it. -- Steven -- http://mail.python.org/mailman/listinfo/python-list