[python-perl] Translation review?
Steve Holden
steve at holdenweb.com
Fri Apr 1 18:58:59 EST 2005
Traceback (most recent call last):
File "<stdin>", line 19, in ?
IOError: [Errno 2] No such file or directory: '<stdin>'
(in both Windows 2.4 and Cygwin 2.4)
regards
Steve
TSO wrote:
> Hi there,
>
>
>
> I've recently tried to translate some Perl code into Python - code is below.
>
>
> Is there a more Pythonic form?
>
>
> Also, is there a good reason why there are plans to remove lambda from the language?
>
>
> yrs complements-of-the-season-ly...
>
>
>
>
>
>
> ==== START OF CODE
>
>
>
>
>
>
>
>
> ## 2005-04-01 - TSO
> ## with apologies to Erudil
>
> import sys,math;[
>
>
> vars()
> .__setitem__(
> "ham", lambda(spam):("").
> join([chr(( spam/144**i)%(02*72))
> for(i)in xrange( int(math.log(spam**0.5,
> 12)+1))])),[(lambda* spam:globals().update({}
> .__class__([spam])))( ham(spam),eval(ham(__spam))
> )for(spam,__spam)in[ (47631497714,0x3A305499C7D37),
> (47159984399, 2337674),(327499859,2336509),(8901
> +34553*10000, 2402179),(6303405375459,2295612),(11+
> 7540504603011, 303839094),(95,2295612),(7540504603011,
> 303839094),(95,0x16241495E6D60314676F55F45E4D3F906),(216*
> 10529,0x1053924DE35309345),(0x6DB401B64DC,0x262efd)]]and(_)
> (ham(231280211),[bacon(spam,ham(0x65936781522))()for(spam)in
> crispy(bacon(bacon((bacon(eggs,ham(0x1051936D9600B6F4F)))(0)
> ,ham(6296985467094)),ham(390129778476214073077203)))]+[bacon(
> ham(32),ham(48473858995))()]),_(ham(110),(lovely)(Spam(cheese
> ,SPAM))),_(ham(231280211),[[int((lambda spam:bacon(bacon(ham
> (32),ham(48473858995))(),ham(330651610))([ham(6961)[bacon((
> spam),ham(+906698009388057))()]for(spam)in(spam)]))(spam+
> spam_),2)for(spam,spam_)in(lambda(spam):[(spam)for(spam)
> in(_spam)(spam[::2],spam[1::2])])(list(_spam(*spam)))]
> for(spam) in(lambda(spam):list(_spam(spam[::2],spam
> [1::2])))([(spam+ham (32)*n)[:n]for(
> spam)in(SPAM) ])])or(Spam)((
> bacon)( bacon(eggs,ham
> (7233055643059
> )),ham(224343
> + 11402701*10**
> 6+ 30804988*10**
> 14) ),[(spam)for
> spam in(_spam)(*[
> (ham( 668732698837
> )%(spam_ ,_spam),ham(
> 668732698 *1000+837)%(
> _spam,spam_ ))for(_spam,
> spam_)in(_spam) (*Spam(lambda
> (spam_,_spam): [bacon(bacon
> (ham(32),ham( 0xB494463B3)
> )(),ham(610+ 330651000))(
> [_spam[spam]for(spam)in(spam)[::spam_
> *-2+1]])for(spam)in(SPAM)],Ham([ham
> (0x40BA541813CECF0323A994C40AA00)
> ,ham(412853488783846916352+
> 20980637114201*10**21
> )])))])])]
>
> == END OF CODE
--
Steve Holden +1 703 861 4237 +1 800 494 3119
Holden Web LLC http://www.holdenweb.com/
Python Web Programming http://pydish.holdenweb.com/
More information about the Python-list
mailing list