Re: Getting rid of bitwise operators in Python 3?

2007-09-26 Thread Anurag
On Sep 22, 8:44 am, Carl Banks [EMAIL PROTECTED] wrote: Anyone with me here? (I know the deadline for P3 PEPs has passed; this is just talk.) 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

Re: Getting rid of bitwise operators in Python 3?

2007-09-23 Thread c d saunter
: arguments and dicts, which are lot more versatile. Another major use, : talking to hardware, is not something oft done in Python either. Are you sure? I've been doing lots of exactly that for 4 years, and I'm not the only one round here... Python makes an excellent language for talking to

Re: Getting rid of bitwise operators in Python 3?

2007-09-23 Thread [david]
[EMAIL PROTECTED] wrote: On Sep 22, 7:04 pm, Marc 'BlackJack' Rintsch [EMAIL PROTECTED] wrote: On Sat, 22 Sep 2007 21:17:38 +, Bryan Olson wrote: The operator module offers pow(). Is there any good reason for pow() as a built-in? The `operator.pow()` is just the function for ``**``, it

Re: Getting rid of bitwise operators in Python 3?

2007-09-22 Thread Carl Banks
On Sat, 22 Sep 2007 05:06:42 +, Stargaming wrote: On Fri, 21 Sep 2007 23:44:00 -0400, Carl Banks wrote: Anyone with me here? (I know the deadline for P3 PEPs has passed; this is just talk.) Not many people are bit-fiddling these days. Why did we invent the `binary literals`_

Re: Getting rid of bitwise operators in Python 3?

2007-09-22 Thread John Machin
On 22/09/2007 1:44 PM, Carl Banks wrote: Anyone with me here? (I know the deadline for P3 PEPs has passed; this is just talk.) 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

Re: Getting rid of bitwise operators in Python 3?

2007-09-22 Thread Robert Kern
Carl Banks wrote: Anyone with me here? (I know the deadline for P3 PEPs has passed; this is just talk.) I'm not. :-) We use them in numpy. The bitwise operations on int and float arrays aren't all that useful, but they are very useful for bool arrays. We can't use the and/or/not keywords

Re: Getting rid of bitwise operators in Python 3?

2007-09-22 Thread Carl Banks
On Sat, 22 Sep 2007 05:19:42 +, Grant Edwards wrote: On 2007-09-22, Carl Banks [EMAIL PROTECTED] wrote: Anyone with me here? (I know the deadline for P3 PEPs has passed; this is just talk.) Not me. Not many people are bit-fiddling these days. I do. Your anecdotal evidence is

Re: Getting rid of bitwise operators in Python 3?

2007-09-22 Thread Bjoern Schliessmann
Carl Banks wrote: On Sat, 22 Sep 2007 05:19:42 +, Grant Edwards wrote: I do. Your anecdotal evidence is noted and given all the consideration it's due. Being funny, or being arrogant? Many today's network protocols work with bit flags. It is /not/ anecdotal. I do it all the time.

Re: Getting rid of bitwise operators in Python 3?

2007-09-22 Thread Grant Edwards
On 2007-09-22, Carl Banks [EMAIL PROTECTED] wrote: If you don't want to use the bitwise operations, then ignore them. Presto! Simpler syntax. Until people no longer need to read code written by others, this argument is utter bull. It's completely besides the point, anyways. The point

Re: Getting rid of bitwise operators in Python 3?

2007-09-22 Thread Paddy
Sorry Carl, I think *you* may not have much need for bitwise operators but others, including myself do. No matter what the usage found, I would think replacing bitwise operators by function calls a retrograde step. - Paddy. -- http://mail.python.org/mailman/listinfo/python-list

Re: Getting rid of bitwise operators in Python 3?

2007-09-22 Thread Bryan Olson
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

Re: Getting rid of bitwise operators in Python 3?

2007-09-22 Thread [EMAIL PROTECTED]
On Sep 21, 10:44?pm, Carl Banks [EMAIL PROTECTED] wrote: Anyone with me here? (I know the deadline for P3 PEPs has passed; this is just talk.) Are you a loony? Python doesn't have enough bit operations. I'm always using the gmpy module's bit functions: digits(...)

Re: Getting rid of bitwise operators in Python 3?

2007-09-22 Thread richyjsm
On Sep 22, 11:13 am, Bryan Olson [EMAIL PROTECTED] wrote: 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. On that subject, I'd suggest that the pow() builtin (not the ** operator

Re: Getting rid of bitwise operators in Python 3?

2007-09-22 Thread Paul Rubin
Carl Banks [EMAIL PROTECTED] writes: If anyone says, But that takes away an easy test for oddness (x1)!, or, But you can multiply powers of two using left shift! Isn't that cool?, I'm not buying it. Those are gimmicks. Arithmetic operations should be done with arithmetic operators. The

Re: Getting rid of bitwise operators in Python 3?

2007-09-22 Thread Carl Banks
On Sat, 22 Sep 2007 12:57:35 +, Grant Edwards wrote: On 2007-09-22, Carl Banks [EMAIL PROTECTED] wrote: Of course it would be. The reason I mention it is that automatic convertibility is a key factor in whether a change can make it into Python 3. It matters not whether fugly code is

Re: Getting rid of bitwise operators in Python 3?

2007-09-22 Thread Carl Banks
On Sat, 22 Sep 2007 14:50:12 +, Paddy wrote: Sorry Carl, I think *you* may not have much need for bitwise operators but others, including myself do. No matter what the usage found, I would think replacing bitwise operators by function calls a retrograde step. Well, if people are going to

Re: Getting rid of bitwise operators in Python 3?

2007-09-22 Thread Terry Reedy
Carl Banks [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] | | Is it worth it to make such a change? It would remove a lot of operators | (11 by my count), vastly simplifying syntax, Which, IMHO, is no small | thing. New numerical types would have fewer operations to support. Py3

Re: Getting rid of bitwise operators in Python 3?

2007-09-22 Thread Bryan Olson
[EMAIL PROTECTED] wrote: Bryan Olson wrote: 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. On that subject, I'd suggest that the pow() builtin (not the ** operator - just

Re: Getting rid of bitwise operators in Python 3?

2007-09-22 Thread Grant Edwards
On 2007-09-22, Carl Banks [EMAIL PROTECTED] wrote: On Sat, 22 Sep 2007 12:57:35 +, Grant Edwards wrote: On 2007-09-22, Carl Banks [EMAIL PROTECTED] wrote: Of course it would be. The reason I mention it is that automatic convertibility is a key factor in whether a change can make it into

Re: Getting rid of bitwise operators in Python 3?

2007-09-22 Thread Marc 'BlackJack' Rintsch
On Sat, 22 Sep 2007 21:17:38 +, Bryan Olson wrote: The operator module offers pow(). Is there any good reason for pow() as a built-in? The `operator.pow()` is just the function for ``**``, it lacks the optional third argument of the built in `pow()`. Ciao, Marc 'BlackJack'

Re: Getting rid of bitwise operators in Python 3?

2007-09-22 Thread richyjsm
On Sep 22, 7:04 pm, Marc 'BlackJack' Rintsch [EMAIL PROTECTED] wrote: On Sat, 22 Sep 2007 21:17:38 +, Bryan Olson wrote: The operator module offers pow(). Is there any good reason for pow() as a built-in? The `operator.pow()` is just the function for ``**``, it lacks the optional

Re: Getting rid of bitwise operators in Python 3?

2007-09-22 Thread Steven D'Aprano
On Sat, 22 Sep 2007 18:09:49 +, richyjsm wrote: On that subject, I'd suggest that the pow() builtin (not the ** operator - just the pow() function) should also be a candidate for removal... Help on built-in function pow in module __builtin__: pow(...) pow(x, y[, z]) - number With

Re: Getting rid of bitwise operators in Python 3?

2007-09-22 Thread richyjsm
On Sep 22, 7:50 pm, Steven D'Aprano [EMAIL PROTECTED] cybersource.com.au wrote: Everybody forgets that pow can take three arguments, except of course for those who use that functionality and would be mighty peeved if it went away. And who is it who uses this functionality? It's useful in

Re: Getting rid of bitwise operators in Python 3?

2007-09-22 Thread George Sakkis
On Sep 22, 3:29 pm, Carl Banks [EMAIL PROTECTED] wrote: On Sat, 22 Sep 2007 14:50:12 +, Paddy wrote: Sorry Carl, I think *you* may not have much need for bitwise operators but others, including myself do. No matter what the usage found, I would think replacing bitwise operators by

Re: Getting rid of bitwise operators in Python 3?

2007-09-22 Thread Paul Rubin
[EMAIL PROTECTED] writes: And who is it who uses this functionality? I use it but I agree it's easy to implement given the underlying bignum arithmetic. It's useful in elementary number theory, sure, but I'd argue that if there are going to be number theoretical functions in the core then

Re: Getting rid of bitwise operators in Python 3?

2007-09-22 Thread richyjsm
On Sep 22, 9:10 pm, Paul Rubin http://[EMAIL PROTECTED] wrote: Certainly xgcd should be in the math library or somewhere similar. It does feel odd to have modular exponentiation in the core but no other number-theoretic stuff in core+libraries. Perhaps a proposal on python-ideas is in order...

Re: Getting rid of bitwise operators in Python 3?

2007-09-22 Thread Paul Rubin
[EMAIL PROTECTED] writes: Well okay, I take that back---I wouldn't mind *writing* it; I just wouldn't expect to get much speed from *running* it. I don't see why not. It's just the basic Python long arithmetic which is coded in C. I tested it against gmpy (carefully written asm code and

Re: Getting rid of bitwise operators in Python 3?

2007-09-22 Thread Paddy
On Sep 22, 8:29 pm, Carl Banks [EMAIL PROTECTED] wrote: On Sat, 22 Sep 2007 14:50:12 +, Paddy wrote: Sorry Carl, I think *you* may not have much need for bitwise operators but others, including myself do. No matter what the usage found, I would think replacing bitwise operators by

Re: Getting rid of bitwise operators in Python 3?

2007-09-22 Thread [EMAIL PROTECTED]
On Sep 22, 10:23?pm, [EMAIL PROTECTED] wrote: On Sep 22, 9:10 pm, Paul Rubin http://[EMAIL PROTECTED] wrote: Certainly xgcd should be in the math library or somewhere similar. It does feel odd to have modular exponentiation in the core but no other number-theoretic stuff in core+libraries.

Getting rid of bitwise operators in Python 3?

2007-09-21 Thread Carl Banks
Anyone with me here? (I know the deadline for P3 PEPs has passed; this is just talk.) 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

Re: Getting rid of bitwise operators in Python 3?

2007-09-21 Thread Stargaming
On Fri, 21 Sep 2007 23:44:00 -0400, Carl Banks wrote: Anyone with me here? (I know the deadline for P3 PEPs has passed; this is just talk.) Not many people are bit-fiddling these days. Why did we invent the `binary literals`_ (0b101) then? One of the main uses of bit fields is flags,

Re: Getting rid of bitwise operators in Python 3?

2007-09-21 Thread Grant Edwards
On 2007-09-22, Carl Banks [EMAIL PROTECTED] wrote: Anyone with me here? (I know the deadline for P3 PEPs has passed; this is just talk.) Not me. Not many people are bit-fiddling these days. I do. One of the main uses of bit fields is flags, but that's not often done in Python because