new bitwise module [was Re: Discussion: new operators ...]

Gregory Lielens gregory.lielens at fft.be
Wed Aug 2 03:40:19 EDT 2000


Huaiyu Zhu wrote:
[snip]
> Someone may give a more official answer, but AFAIK, I suppose we could just
> put in a few more docstrings and submit it to the python-dev list?  I'm not
> sure this need a PEP, but it wouldn't hurt.  The PEP would describe why
> named functions are better, how this module is going to replace the bitwise
> operators, and hints on a C implementation when the bitwise operators are
> decommisioned.  I hope you could do this, as I'm still struggling with the
> PEP for math operators at my spare time.
> 
> Or, if Guido or Tim is listening on this thread, what's your opinion?
> 
> Huaiyu

I just read about your proposal, and it is great! Coming from C, I do
not have problem with the bitwise operators (although I forget the
precedence sometimes), but peoples without C background (is it
possible?) should appreciate! However, I would not remove bitwise op
personally, I would prefer to replace them with ~not, ~or, ...i.e. an
element version of the logical operators!
It would allow 2 syntaxes : bitand(a,b,c,d) or a ~and b ~and c ~and d,
for example...
The advantage is that it would make translation of current python
trivial : just change | to ~or, ...

Greg.



More information about the Python-list mailing list