Adding static typing to Python

brueckd at tbye.com brueckd at tbye.com
Tue Feb 19 14:43:17 EST 2002


On 19 Feb 2002, Quinn Dunkan wrote:

> On 19 Feb 2002 00:59:42 -0800, Alexander Jerusalem <ajeru at vknn.org> wrote:
> >There's another thing that bugs me with the missing static typing and
> >that is that it makes code less readable. I don't know what I can do
> >with a function parameter when I see it. For example, when I see a
> >function like def computeSalary(person)... I don't know at first sight
> >if person is the id of person, a person object and if it's an object
> >what its exact class in a Person class hierarchy is. I have to find
> >the place where the constructor is called to find that out. That's not
>
> Or you can just look and see how the 'person' is used in the function.  If the
> first statement is a 'o = db.by_id[person]' then you know it's an id.  If it

An even better approach is to ask yourself: if it's a person's ID, then
why isn't the variable named personID?

-Dave





More information about the Python-list mailing list