Python's Exception, and Capitalization

D H no at spam
Fri Aug 12 10:49:08 EDT 2005


Ray wrote:
> Hello guys,
> 
> OK, I've been reading some more about Python. There are some things
> about Python exception that I haven't been able to grasp:
> 
> 1. This is a small thing, but why is object spelled "object", and the
> mother of all exception "Exception" (with capital E)? Why is not object
> spelled "Object" then? 

I would guess that object is considered a primitive/basic type like int 
or float or string.


> I mean, in Java,
> it's Object. Whereas in C++, they're quite consistent, standard stuff
> are usually all lowercaps (basic_string, iostream, etc.). Python seems
> to have a mix of both.

Yeah java capitalizes anything that is a class like String, Object, 
Integer, and lowercases its primitives like int, byte.


> By the way, what's the convention for functions? It's a bit confusing
> because when I see Python builtins, it seems that they follow C++ style
> (e.g.: has_key, readline). So... does it mean that when I write my own
> function, customarily I'd say myFunction() (or MyFunction()?)

Yeah, the python standard library has been built by lots of different 
people.  It wasn't designed by one entity using one standard like the 
java standard library or .NET/Mono class library.


> 2. I'm quite baffled that you either have try/except, or try/finally.

Apparently that will be fixed sometime:
http://python.miscellaneousmirror.org/peps/pep-0341.html



More information about the Python-list mailing list