469,353 Members | 2,053 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

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

Python keywords vs. English grammar

I noticed something interesting today. In C++, you write:

try {
throw foo;
} catch {
}

and all three keywords are verbs, so when you describe the code, you can
use the same English words as in the program source, "You try to execute
some code, but it throws a foo, which is caught by the handler".

In Python, you write:

try:
raise foo
except:

and now you've got a mix of verbs and (I think), a preposition. You can't
say, "You try to execute some code, but it raises a foo, which is excepted
by the handler". It just doesn't work grammatically.

Sigh.
May 24 '06 #1
7 1173
I'm not a english speaker, so I just accepted it...;

I understood it as :
'Try' allways to execute this code, 'except' when it doesn't work do
this....

I noticed something interesting today. In C++, you write:

try {
throw foo;
} catch {
}

and all three keywords are verbs, so when you describe the code, you can
use the same English words as in the program source, "You try to execute
some code, but it throws a foo, which is caught by the handler".

In Python, you write:

try:
raise foo
except:

and now you've got a mix of verbs and (I think), a preposition. You can't
say, "You try to execute some code, but it raises a foo, which is excepted
by the handler". It just doesn't work grammatically.

Sigh.

--
---
Rony Steelandt
BuCodi
rony dot steelandt (at) bucodi dot com

Visit the python blog at http://360.yahoo.com/bucodi
May 24 '06 #2
Roy Smith wrote:
I noticed something interesting today. In C++, you write:

try {
throw foo;
} catch {
}

and all three keywords are verbs, so when you describe the code, you can
use the same English words as in the program source, "You try to execute
some code, but it throws a foo, which is caught by the handler".

In Python, you write:

try:
raise foo
except:

and now you've got a mix of verbs and (I think), a preposition. You can't
say, "You try to execute some code, but it raises a foo, which is excepted
by the handler". It just doesn't work grammatically.

Sigh.


It does, but it's maybe not 'plain English'.

http://dictionary.reference.com/search?q=except

Duncan
May 24 '06 #3
Roy Smith wrote:
try {
throw foo;
} catch {
} try:
raise foo
except:


But which one is prettier? ;)
May 24 '06 #4
1. Does it matter?
2. Is it affecting your productivity.
3. Are you not trying to programme?
4. It is open source, change it and stop whining.

May 24 '06 #5
defcon8 wrote:
1. Does it matter?
2. Is it affecting your productivity.
3. Are you not trying to programme?
4. It is open source, change it and stop whining.


What about trying emacs <alt>+x doctor <return> ?

--
bruno desthuilliers
python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in 'o****@xiludom.gro'.split('@')])"
May 24 '06 #6
Roy Smith wrote:
I noticed something interesting today. In C++, you write:

try {
throw foo;
} catch {
}

and all three keywords are verbs, so when you describe the code, you can
use the same English words as in the program source, "You try to execute
some code, but it throws a foo, which is caught by the handler".
Not convincing at all, since the *explicit* throw/raise lexically inside a try
block with a catch/except clause that's *predetermined* to catch it... is the
exception rather than the rule. Normally you'd use another form of block exit.
Or is the case different in C++ by any chance ?

In Python, you write:
usually, you don't write something similar to that, and neither in C++ I guess.
try:
raise foo
except:

and now you've got a mix of verbs and (I think), a preposition. You can't
say, "You try to execute some code, but it raises a foo, which is excepted
by the handler". It just doesn't work grammatically.

Sigh.

May 24 '06 #7
In article <44**********@news.bluewin.ch>,
Boris Borcic <bb*****@gmail.com> wrote:
Roy Smith wrote:

and all three keywords are verbs, so when you describe the code, you can
use the same English words as in the program source, "You try to execute
some code, but it throws a foo, which is caught by the handler".


Not convincing at all


I wasn't trying to convince anybody of anything. Just making an
observation.
May 25 '06 #8

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

699 posts views Thread by mike420 | last post: by
9 posts views Thread by seberino | last post: by
852 posts views Thread by Mark Tarver | last post: by
12 posts views Thread by Steve Howell | last post: by
6 posts views Thread by vedrandekovic | last post: by
6 posts views Thread by vedrandekovic | last post: by
145 posts views Thread by Dave Parker | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by suresh191 | last post: by
1 post views Thread by Marylou17 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.