Binary Sort on Python List __xor__

Evan Schalton evan.schalton at gmail.com
Sun May 31 12:24:56 EDT 2020


Peter,

This isn't a ram consideration as much it's a logical consideration. There are a lot of ways to handle this, I REALLY don't want to use a package here. Bit masking is incredibly useful for permutations/combinatoric algorithms. I can create my own class wrapper or functions, and optimize, but think that the __and__ operator would be a really useful syntactic tool. It would streamline these types of operations and *hopefully* help people write more efficient code.

I'm less strictly interested in the & operator explicitly working with a bit int, but think it'd be great if the was a built-in filter something like:

[1,2,3,4] & [0,0,1,1] => [3,4] OR
[1,2,3,4] & [False, False, True, True] = [3,4]


More information about the Python-list mailing list