A rather unpythonic way of doing things

P

Peter Corbett

One of my friends has recently taken up Python, and was griping a bit
about the language (it's too "prescriptive" for his tastes). In
particular, he didn't like the way that Python expressions were a bit
crippled. So I delved a bit into the language, and found some sources
of syntactic sugar that I could use, and this is the result:

http://www.pick.ucam.org/~ptc24/yvfc.html

Peter
 
J

Jeff Schwab

Peter said:
One of my friends has recently taken up Python, and was griping a bit
about the language (it's too "prescriptive" for his tastes). In
particular, he didn't like the way that Python expressions were a bit
crippled. So I delved a bit into the language, and found some sources
of syntactic sugar that I could use, and this is the result:

http://www.pick.ucam.org/~ptc24/yvfc.html

Yuma Valley Agricultural Center?
Yaak Valley Forest Council?
 
M

Michael Ekstrand

One of my friends has recently taken up Python, and was griping a bit
about the language (it's too "prescriptive" for his tastes). In
particular, he didn't like the way that Python expressions were a bit
crippled. So I delved a bit into the language, and found some sources
of syntactic sugar that I could use, and this is the result:

http://www.pick.ucam.org/~ptc24/yvfc.html

Umm, TMTOWTDI? As uniform as Python is, it still is flexible...

Brilliant. Simply brilliant.

-Michael
 
F

Fredrik Lundh

fraca7 said:
print ''.join(map(lambda x: chr((((ord(x) - ord('a')) + 13) % 26) + ord('a')), 'yvfc'))

that's spelled

print "yvfc".decode("rot-13")

or, if you prefer,

print "yvfc".encode("rot-13")

, in contemporary python.

</F>
 
R

Rocco Moretti

fraca7 said:
Richie Hindle a écrit :
[Peter]
http://www.pick.ucam.org/~ptc24/yvfc.html


[Jeff]

Yuma Valley Agricultural Center?
Yaak Valley Forest Council?



I went through the same process. My guess is "Yes, Very F'ing Clever."
Peter?

print ''.join(map(lambda x: chr((((ord(x) - ord('a')) + 13) % 26) +
ord('a')), 'yvfc'))

Less pythonic:

__import__('sys').stdout.write(''.join(map(lambda x: chr((((ord(x) -
ord('a')) + 13) % 26) + ord('a')), 'yvfc'))

More Pythonic:

print 'yvfc'.decode('rot13')
 
S

Simon Brunning

that's spelled

print "yvfc".decode("rot-13")

or, if you prefer,

print "yvfc".encode("rot-13")

, in contemporary python.

I'm not sure that being more comprehensible is considered a virtue in
this thread, /F. ;-)
 
T

Tom Anderson

One of my friends has recently taken up Python, and was griping a bit
about the language (it's too "prescriptive" for his tastes). In
particular, he didn't like the way that Python expressions were a bit
crippled. So I delved a bit into the language, and found some sources of
syntactic sugar that I could use, and this is the result:

http://www.pick.ucam.org/~ptc24/yvfc.html

It's this sort of thing that makes it clear beyond all shadow of a doubt
that Cambridge should be razed to the ground.

Keep up the good work.

tom
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,596
Members
45,135
Latest member
VeronaShap
Top