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

Tim Peters tim_one at email.msn.com
Tue Aug 1 19:02:11 EDT 2000


[Alex Martelli, as quoted by Huaiya Zhu]
> """ bitwise.py - replaces builtin bitwise operations with named functions
> """
> [snip]
>
> OK, so, how does one proceed now?  We have a new simple and general
> purpose module that we believe might be beneficial to include in the
> standard distribution -- what do we send were to submit it?
> Anybody knows?

Probably best at first to put it on the web and link to it from the Vaults
of Parnassus.  Getting a new module into the core is difficult these days
unless it has a broad and persistent constituency (e.g., XML); making it
available thru the Vaults gives it a shot at building a user base.

[Huaiyu Zhu]
> 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.

Proposing to deprecate the shift and bitwise operators in favor of named
functions has no chance without a PEP.  I counted three people in all with
favorable reactions on c.l.py (Paul Foley surely was, as Alex detected,
gently ribbing it by taking the idea to its logical conclusion and
reinventing Lisp).  That's a start, but not much support yet.

That nobody expressed outrage strongly suggests that the "new operators"
thread and its offshoots have gone on at such length that only a few are
following them anymore.  So at this point a PEP seems the only way to get
others to even *see* the idea.

> 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 could have sworn that just two weeks ago you were passionately arguing
that named functions are intolerable for *your* field of interest <0.7
wink>.  So be sure to explain why they're better than infix operators for
those who like slinging ints.  I happen to sling more ints than matrices
myself, and find no appeal in, e.g., needing to write bitleft(x, 1) instead
of x << 1.  And after augmented assignments are in, I would strongly prefer
writing

    a[i] <<= 1

to

    a[i] = bitleft(a[i], 1)

I may not be unique in that respect <wink>.

getting-rid-of-something-is-very-much-harder-than-adding-
    something-new-ly y'rs  - tim






More information about the Python-list mailing list