[Tutor] Bits operations [another version of binary() using hex()]

Magnus Lyckå magnus@thinkware.se
Mon Jul 14 15:17:02 2003


At 11:37 2003-07-14 -0700, Jeff Shannon wrote:
>In my opinion, support for octal is now a historical relic.

There is at least one important exception...

PostScript and thus also PDF handles octal representation
in strings. Thus (Python) and (\120ython)  are equivalent
to PostScript and PDF. If you want to write the same string
with hex, all characters must be hex, and you have to write:
<507974686f6e>.

This meant that ReportLab broke and had to be rewritten in
a slightly more complicated way when Python changed so that
"print repr('Lyckå')" started to return 'Lyck\xe5' instead
of 'Lyck\345'. It had basically put texts into PDF files with
something like
   "(%r)" % text
and that stopped working...

You never know where these anachronisms hide...


--
Magnus Lycka (It's really Lyck&aring;), magnus@thinkware.se
Thinkware AB, Sweden, www.thinkware.se
I code Python ~ The Agile Programming Language