Does Python need a '>>>' operator?

Ken Peek Ken.Peek at SpiritSongDesigns.comNOSPAM
Mon Apr 15 11:19:01 EDT 2002


"Martin v. Loewis" <martin at v.loewis.de> wrote in message
news:m3lmbpoyai.fsf at mira.informatik.hu-berlin.de...

| "Ken Peek" <Ken.Peek at SpiritSongDesigns.comNOSPAM> writes:
|
| > 2) Secondly, when we are printing integers in the hex format,
| > we are not interested in the sign-- we are looking at the
| > bit pattern.
|
| Who is this "we" in this statement? When I print numbers in hex, I'm
| interested in the hexadecimal representation if the number. For
| *printing* it, I usually don't care what the internal representation
| is.

That would be most people that need to get inside and take a look at the bit
representation of a number-- when doing things like developing new random nubmer
generators, and encryption techniques.  There are other examples of course, but
you should get the idea.  When _I_ want to se a number in hex, it is because I
am interested in the bit pattern.  I'm sure many others feel the same way about
it.  I have only been programming for 30 years, (professionally for 25)-- so
maybe I don't have enough experience to give you the right answer to this.

| > 3) With unification, the long and the int types should not
| > print differently when calling the 'hex()' method.
|
| And indeed, they won't.
|
| > (The 'int' version of this method NEVER has, and shouldn't print a
| > minus sign, and _I_ don't think the long version of 'hex()' should
| > either.  This _is_ what needs to happen to have proper unification.
|
| The PEP currently says differently:
|
| # In most cases the long int semantics will prevail; however, the
| # trailing 'L' from long int representations will be dropped.
|
| This clearly says that the long int semantics will prevail.

Yes-- I read the PEP too--  when this happens, I will consider it a Python
"_WART_", and will set about inventing ways around it for my own use.  I have
forgotten more computer languages than most people will ever learn-- an I have
NEVER found printing a hexadecimal number in sign and magnitude format to be
useful...

I will say it again: when I am printing a number in hexadecimal, I am interested
in the _BIT_PATTERN_ -- _NOT_ the numeric _VALUE_.  I'm sure many others feel
this way as well.

| > 4) We are not using 1.5.2 anymore.  We are on 2.2.x now.
| > You need to imprint on your brain that there now should be
| > _NO_ visible difference (to the programmer) between the long
| > and the int type.  In fact, the int and long representations
| > are now just an implementation detail, and should be hidden,
| > and transparent to the programmer.
|
| I completely agree.
|
| > Martin, why do you resist the unification of these two
| > types for _ALL_ operations and methods?
|
| Why did you conclude that I resist? I'm just saying that the long
| semantics will prevail, not the int semantics.

Again-- when this change is made, I think it will be a Python "_WART_".
Numbers should only print the sign and magnitude when printing decimal numbers.
When printing hexadecimal numbers, the bit pattern is what is needed-- not the
sign and magnitude.

wart- Wart- WART- WWAAARRTT!!!!!






More information about the Python-list mailing list