Thanks for Python...

William Tanksley wtanksle at dolphin.openprojects.net
Wed Jun 23 16:24:59 EDT 1999


On 23 Jun 1999 13:06:49 PDT, Mordy Ovits wrote:
>Jeff Rush wrote:

>> Welcome to the Python community, John.  Yes, Python is a truly
>> wonderful language for cranking out quick prototypes or test jigs.
>> I prototyped a complete web-based general ledger system in Python,
>> figuring I'd downcode it to C for speed later, but so far I haven't needed
>> to.  Python is also just plain fun...  Now if I could just get time to port
>> it to the PalmPilot, I'd never be away from it.

>Get a Windows CE Palm-sized PC if you want to take Python with you whereever you
>go.  Python runs stunningly well on my Casio E-100, and has nifty GUI
>libraries.  It's not polished by any sense of the word but it works, and the
>source is a barely changed version of the standard windows Python.  This makes
>for easy improvement.

Sure, but we've got Pilots, so that's not an open option.  Fortunately,
the Pilot has Quartus Forth available for it -- it's not Python, but
honestly, Forth fits the limitations of the device better.

I used Quartus on my Crypto exam to solve a modular equation after I
forgot how to solve modular equations (I had it use brute force).

I'd still like to have Python, but dang, Quartus is good at what it does.
Python and Forth -- for two different reasons, pretty much my favorite
languages.

>o Mordy Ovits
>o Cryptographic Engineer
>o LockStar Inc.

>#!/usr/local/bin/python 
>from sys import*;from string import*;a=argv;[s,p,q]=filter(lambda x:x[:1]!=
>'-',a);d='-d'in a;e,n=atol(p,16),atol(q,16);l=(len(q)+1)/2;o,inb=l-d,l-1+d
>while s:s=stdin.read(inb);s and map(stdout.write,map(lambda i,b=pow(reduce(
>lambda x,y:(x<<8L)+y,map(ord,s)),e,n):chr(b>>8*i&255),range(o-1,-1,-1)))

You know, the first time I saw this it was in ESR's .sig, and I tried to
remember how long the Perl version had been.  A few minutes of searching
revealed that it was three lines long -- but also revealed that it was
using bc rather than Perl to do most of the work!  I spent about half an
hour searching for the real Perl version, only to find that it was five
lines long.

The Python for this .sig is shorter than the Perl!  Cool, eh?

-- 
-William "Billy" Tanksley
Utinam logica falsa tuam philosophiam totam suffodiant!
   :-: May faulty logic undermine your entire philosophy!




More information about the Python-list mailing list