M
Michael Tobis
I came across the "japh" concept today and decided to do one of my
own, obviously, interpreting the 'p' somewhat loosely,
http://en.wikipedia.org/wiki/JAPH
but I'm not entirely satisfied with it:
####
# japh, for certain values of 'p'
f=lambda(r,N):N and f((" acdefijlmnopqrstuv"[N%19]+r,N/19))or(r,N)
print f( ("",reduce(lambda
c,m:c*95+''.join(map(chr,range(32,127))).index(m),
"!b)'1Mgh0z+fYQ]g::i^<&y~g)cnE-d=K&{GMNQ1gx+ooY<~L##N'X]P2<@XYXwX3z",
0)))[0]
####
it bothers me that there are two statements. (In case you are
wondering what they do, it's all essentially about changing from base
95 to base 19. It's based loosely on this fine, simple recipe by Drew
Perttula which I have found to be useful on several occasions:
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/111286
)
Anyway, I'd much prefer an even uglier japh like this:
# does not work
print (lambda(r,N):N and $$$$((" acdefijlmnopqrstuv"[N%19]+r,N/
19))or(r,N))(
("",reduce(lambda c,m:c*95+''.join(map(chr,range(32,127))).index(m),
"!b)'1Mgh0z+fYQ]g::i^<&y~g)cnE-d=K&{GMNQ1gx+ooY<~L##N'X]P2<@XYXwX3z",
0)))[0]
but what would $$$$ be for an unnamed function to call itself?
I realize that lambda is something of an orphan and was arguably a bad
idea for anything besides obfuscation, but obfuscation is exactly my
purpose here. Can a lambda call itself without giving itself a name?
Google was not my friend on this one, and I suspect there is no
answer. Relax, I am not going to submit a PEP about it.
mt
own, obviously, interpreting the 'p' somewhat loosely,
http://en.wikipedia.org/wiki/JAPH
but I'm not entirely satisfied with it:
####
# japh, for certain values of 'p'
f=lambda(r,N):N and f((" acdefijlmnopqrstuv"[N%19]+r,N/19))or(r,N)
print f( ("",reduce(lambda
c,m:c*95+''.join(map(chr,range(32,127))).index(m),
"!b)'1Mgh0z+fYQ]g::i^<&y~g)cnE-d=K&{GMNQ1gx+ooY<~L##N'X]P2<@XYXwX3z",
0)))[0]
####
it bothers me that there are two statements. (In case you are
wondering what they do, it's all essentially about changing from base
95 to base 19. It's based loosely on this fine, simple recipe by Drew
Perttula which I have found to be useful on several occasions:
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/111286
)
Anyway, I'd much prefer an even uglier japh like this:
# does not work
print (lambda(r,N):N and $$$$((" acdefijlmnopqrstuv"[N%19]+r,N/
19))or(r,N))(
("",reduce(lambda c,m:c*95+''.join(map(chr,range(32,127))).index(m),
"!b)'1Mgh0z+fYQ]g::i^<&y~g)cnE-d=K&{GMNQ1gx+ooY<~L##N'X]P2<@XYXwX3z",
0)))[0]
but what would $$$$ be for an unnamed function to call itself?
I realize that lambda is something of an orphan and was arguably a bad
idea for anything besides obfuscation, but obfuscation is exactly my
purpose here. Can a lambda call itself without giving itself a name?
Google was not my friend on this one, and I suspect there is no
answer. Relax, I am not going to submit a PEP about it.
mt