Python keywords vs. English grammar

R

Roy Smith

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.
 
R

Rony Steelandt

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
 
D

Duncan Smith

Roy said:
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
 
D

defcon8

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.
 
B

bruno at modulix

defcon8 said:
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> ?
 
B

Boris Borcic

Roy said:
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.
 

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,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top