Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
hexadecimal world
#1
i am thinking of hacking a version of the python interpreter to use hexadecimal (which i call "cetal"), without the leading "0x", as the default everywhere. a new designation (0z) would be added for decimal.
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply
#2
You really like to waste time don't you.
Reply
#3
I was very angry about the leading 0x until I have seen binascii and formatting.

In [22]: import binascii                                                        

In [23]: binascii.hexlify(b'Hello World')                                       
Out[23]: b'48656c6c6f20576f726c64'

In [24]: binascii.unhexlify(_)                                                  
Out[24]: b'Hello World'

In [25]: x = 42                                                                 

In [26]: f'{x:x}'                                                               
Out[26]: '2a'

In [27]: f'{x:010x}'                                                            
Out[27]: '000000002a'
Almost dead, but too lazy to die: https://sourceserver.info
All humans together. We don't need politicians!
Reply
#4
(Apr-05-2019, 07:37 AM)Larz60+ Wrote: You really like to waste time don't you.
it doesn't take much time in my imaginary world (nothing to do with complex numbers).

i avoid the leading 0x where i can, such as in the cetal world. i am thinking of using 6 Greek letters for a..f: alpha, beta, sigma, delta, gamma, phi, lower case in that order. then where i need a prefix i can use chi. i would then define the use of any other letter as not taking a position (so chi can be anywhere in the digit sequence to do its thing).
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Hack the world! - soon wavic 3 3,422 Apr-05-2017, 08:22 PM
Last Post: Ofnuts

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020