[Chicago] Can you write Perl in Python?
Ian Bicking
ianb at colorstudy.com
Tue Dec 27 21:45:13 CET 2005
On 12/27/05, Michael Tobis <mtobis at gmail.com> wrote:
> While it's often said that "you can write Fortran in any language",
> not every language allows you to write Perl. Nevertheless, there is a
> contest running this week to do exactly that in Python, i.e., minimize
> your character count while doing something reasonably useful.
>
> http://www.pycontest.net/
>
> My best to date is 221 characters, but folks on c.l.p. (see "python
> coding contest" thread) are claiming non-cheats of under 140
> characters. I may take another stab at it; my 221 character code is
> alarmingly sane and readable. I had a much more baroque and Perlishly
> flavored version but it turned out to be 20 characters longer...
An interesting contest. My first simple try came in at 220
characters, but after trying a bunch of different techniques (most of
which increased the size) I was only able to get it down to 214
characters (which is just minor refinements to my first version).
Using the built-in zlib compression (s.encode('zlib')) I can get that
in turn down to 175 characters (actually making use of that
compression is an excersize left to the reader). 140 characters is
pretty tricky; I'm guessing there's some useful pattern in the data
for the numbers that could be used.
--
Ian Bicking | ianb at colorstudy.com | blog.ianbicking.org
More information about the Chicago
mailing list