python coding contest

Roman Susi rnd at onego.ru
Wed Dec 28 02:59:49 EST 2005


Tim Hochberg wrote:
> py pan wrote:
> 
>>When you guys say 127~150 characters, did you guys mean
>>usinging test_vectors.py in some way? Or there's no import at all?
>>
> 
> 
> No import at all. The shortest solution reported so far is 131 
> characters. Getting down to 127 is just a guess as to where the lower 
> bound is likely to be.
> 
> 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

Condensing is good but only as far as code for decompressing is small...

By the way, after I noticed that I program for 2.3, I tried with 2.4 and
 get out extra characters thanks for generator expression and .join()
integration. So now I am at 147. Probably a lot of reserve as I have 3
fors... One for just for the purpose of getting a name:

...x.... for x in [scalar]

Probably its time rething solution from scratch...


Roman Susi



More information about the Python-list mailing list