Carl Banks wrote: > Not many people are bit-fiddling these days. One of the main uses of bit > fields is flags, but that's not often done in Python because of keyword > arguments and dicts, which are lot more versatile. Another major use, > talking to hardware, is not something oft done in Python either. [...] > Of course I'm not suggesting to get rid of bitwise operations altogether; > just make them builtin functions: "x & 1" becomes "bitwise_and(x,1)" and > so on.
Based on one informal survey (of my recollection), many Pythoneers bit-twiddle, and all of them also know C. For this population, Python's adoption of C's bitwise operators helps avoid user-out-of-memory errors. Python even kept C's counter-intuitive low precedence for shifts. One surprising result was that more of the Python programmers surveyed use bitwise operators than are aware of the exponentiation operator, which C does not offer. Possibly the study used a bias sample. -- --Bryan -- http://mail.python.org/mailman/listinfo/python-list