python coding contest

Justin Azoff justin.azoff at gmail.com
Tue Dec 27 17:35:30 EST 2005


Tim Hochberg wrote:
> Note that in principle it's possible to encode the data for how to
> display a digit in one byte. Thus it's at least theoretically possible
> to condense all of the information about the string into a string that's
> 10 bytes long. In practice it turns out to be hard to do that, since a
> 10 byte string will generally have a representation that is longer than
> 10 bytes because of the way the escape sequences get printed out. As a
> result various people seem to be encoding the data in long integers of
> one sort or another. The data is then extracted using some recipe
> involving shifts and &s.
>
> -tim

I have a 163 character version(on 8 lines, haven't tried to compress it
further) that does something like that.. the string ended up being
printable enough to be included in the source unescaped.

I think for most approaches, any space you save by using a string you
lose after quoting it and using ord() to turn a character back into a
number.

I'm sure this particular method is a dead end, but it is a very
intersting and probably unique  solution :-)

-- 
- Justin




More information about the Python-list mailing list