469,281 Members | 2,450 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,281 developers. It's quick & easy.

A rather unpythonic way of doing things

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

--
A frightful hobgoblin is stalking throughout Europe.
- The Communist Manifesto, 1st English Edition
Sep 29 '05 #1
13 1303

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


Beautiful! Greenspun's Tenth Rule[1] performed before your very eyes! (Not
quite, because you started with Python so you were already half way there.
And yours probably isn't buggy. 8-)

[1] http://en.wikipedia.org/wiki/Greenspun's_Tenth_Rule

--
Richie Hindle
ri****@entrian.com
Sep 29 '05 #2
Peter Corbett <pc******@chiark.greenend.org.uk> writes:
http://www.pick.ucam.org/~ptc24/yvfc.html


Madness! I love it.
Sep 29 '05 #3
Peter Corbett wrote:
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?
Sep 29 '05 #4

[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?

--
Richie Hindle
ri****@entrian.com
Sep 29 '05 #5
Richie Hindle <ri****@entrian.com> writes:

[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?


You're all thinking about it the wrong way (he says, being cryptic).

Peter

--
A frightful hobgoblin is stalking throughout Europe.
- The Communist Manifesto, 1st English Edition
Sep 29 '05 #6
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'))

:)
Sep 29 '05 #7
fraca7 wrote:
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'))

:)


LOL. Thank you!
Sep 29 '05 #8
On Thursday 29 September 2005 04:53, Peter Corbett wrote:
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
Sep 29 '05 #9

[Peter]
http://www.pick.ucam.org/~ptc24/yvfc.html
[fraca7] print ''.join(map(lambda x: chr((((ord(x) - ord('a')) + 13) % 26) +
ord('a')), 'yvfc'))


Ah! Or more easily, Edit / Apply ROT13. Thanks!

--
Richie Hindle
ri****@entrian.com
Sep 29 '05 #10
fraca7 wrote:
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')
Sep 29 '05 #11
"fraca7" wrote:
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>

Sep 29 '05 #12
On 9/29/05, Fredrik Lundh <fr*****@pythonware.com> wrote:
"fraca7" wrote:
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.


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

--
Cheers,
Simon B,
si***@brunningonline.net,
http://www.brunningonline.net/simon/blog/
Sep 29 '05 #13
On Thu, 29 Sep 2005, Peter Corbett wrote:
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

--
I'm not quite sure how that works but I like it ...
Oct 1 '05 #14

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Lee, Dustin | last post: by
16 posts views Thread by Lorem Ipsum | last post: by
2 posts views Thread by Scott Manson | last post: by
7 posts views Thread by BrJohan | last post: by
32 posts views Thread by lovecreatesbea... | last post: by
3 posts views Thread by notnorwegian | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.