re: Intersection, union and difference of Sets in Python. VIEW POST

TOP OF THREAD FULL DISCUSSION
re: Python is a high level language though, there's no builtin concept of masking bits so, taking into account that we can't assume C knowledge by the ...

I agree that the long names are more readable, but Python does provide operators for & and | already; on integers they provide the bitwise logic, same as in C.

>>> 3 & 4
0
>>> 4 & 4
4
>>> 4 & 7
4
>>> 3 | 4
7

Also some things make use of those operators for other purposes; for example, Peewee ORM uses them for its query generator.

Anyway, just because a language is high level doesn't mean it doesn't (and shouldn't) provide bitwise functionality. Bitwise operations are still really useful for a lot of purposes in a lot of fields and I absolutely would not discount how necessary they are.

Oh thanks fluffy, I totally forgot about those. I rarely see them anywhere that I probably forgot :) My bad!

Anyway, just because a language is high level doesn't mean it doesn't (and shouldn't) provide bitwise functionality. Bitwise operations are still really useful for a lot of purposes in a lot of fields and I absolutely would not discount how necessary they are.

Can't argue with that hehe

code of conduct - report abuse