473,395 Members | 1,681 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

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 1390

[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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Lee, Dustin | last post by:
I'm looking for an example of a well designed web application used to do sys-admin type functions. Our company has a fairly large internal python web-app that we use for managing DNS,...
1
by: Chris K | last post by:
I am relatively new to C++ and hope that this question is relevant. I have spent some time at the local library and some time on dejanews, but have no decided to go ahead with my question, since...
16
by: Lorem Ipsum | last post by:
I am preparing to hire a general web programmer and in the process talked to one who said something that surprised me. He laughed and said, "Nobody codes anything from scratch. We all take code...
37
by: MLH | last post by:
For example: Nz(,0) returns "300" if the value in field is 300 (currency data type) and "0" if the value is zero or null. I get strings in the query output - they are all left aligned and I...
2
by: Scott Manson | last post by:
StringBuilder bldr=new StringBuilder(); int res=GetClassName(0x00240110,bldr,255); Debug.WriteLine(bldr.ToString()); if(bldr.ToString()=="AfxFrameOrView42s") Debug.Write("Things SHOULD work");...
7
by: BrJohan | last post by:
Assume having this class hierarchy: (in principle and without details) class A(object): class B1(A): class B2(A): class C1(A1): class C2(A1): class C3(B1): class C4(B2): each of those...
5
by: tom | last post by:
Hi, I'm overriding my operator new and operator delete for two classes, one inherited from the other, so I can use my own memory pool. A simplified version of what I have is below: class...
12
by: sparks | last post by:
My boss and I both have access 97 and access 2003 installed on our systems. Lately he has been having a lot of problems. Databases that won't close. The database looks like it closes but access...
32
by: lovecreatesbea... | last post by:
In C++ Primer 4th, sec 3.3.2, it states that C++ programmers use != rather than < in a for loop. The following small snippet erases punctuations in a string. It works well with < used in the for...
3
by: notnorwegian | last post by:
i have some confusion over this. sure a class is basically a classification, like for example an animal or flower. and an object/instance of that class is then for example a cat. an object is...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.