Adding static typing to Python
Quinn Dunkan
quinn at regurgitate.ugcs.caltech.edu
Tue Feb 19 16:51:41 EST 2002
More information about the Python-list mailing list
Tue Feb 19 16:51:41 EST 2002
- Previous message (by thread): Adding static typing to Python
- Next message (by thread): Adding static typing to Python
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
> On 19 Feb 2002, Quinn Dunkan wrote: > > 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 i > t > > An even better approach is to ask yourself: if it's a person's ID, then > why isn't the variable named personID? I didn't say that because the OP could have objected that "then you're just encoding the type information in the variable name". And I would agree with him to an extent. Naming variables based on their type leads to the same problem you get in static systems, when the type becomes obsolete. The variable doesn't actually have to be an id, it just has to be something that you can look up in the db. So the actual type requirements are in whoever is calling the function, and the db object. They could both change, and now 'personID' is misleadingly named. (of course, 'db.by_id' would then also be misnamed, but lets assume it was a more generic 'db[...]') Taken to its logical extreme, this seems to imply that all variable names should be quite vague if the function is just passing it along, which could get silly. But taking things to their logical extremes often does get silly :)
- Previous message (by thread): Adding static typing to Python
- Next message (by thread): Adding static typing to Python
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list