Possible improvement to slice opperations.

Steve Holden steve at holdenweb.com
Mon Sep 5 17:10:05 EDT 2005


Paul Rubin wrote:
> Steve Holden <steve at holdenweb.com> writes:
> 
>>Given that Python has a 1's-complement operator already I don;t see
>>why you can't just leave Python alone and use it,
> 
> 
> What's the meaning of the 1's complement operator (for example, what
> is ~1), when ints and longs are the same?

Python 2.2.1 (#1, Aug 25 2004, 16:56:05)
[GCC 2.95.4 20011002 (Debian prerelease)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
 >>> ~1L
-2L
 >>> ~1
-2
 >>> import sys
 >>> sys.maxint*4
8589934588L
 >>> ~(sys.maxint*4)
-8589934589L
 >>>

$ python
Python 2.4.1 (#1, May 27 2005, 18:02:40)
[GCC 3.3.3 (cygwin special)] on cygwin
Type "help", "copyright", "credits" or "license" for more information.
  >>> ~1L
-2L
  >>> ~1
-2
  >>> sys.maxint*4
8589934588L
  >>> ~(sys.maxint*4)
-8589934589L
  >>>

What's going to change when ints and longs are finally integrated?

regards
  Steve
-- 
Steve Holden       +44 150 684 7255  +1 800 494 3119
Holden Web LLC             http://www.holdenweb.com/




More information about the Python-list mailing list