Proposal: local variable declarations and type advice
Paul Rubin
phr-n2002a at nightsong.com
Tue Feb 26 02:50:54 EST 2002
More information about the Python-list mailing list
Tue Feb 26 02:50:54 EST 2002
- Previous message (by thread): Proposal: local variable declarations and type advice
- Next message (by thread): Proposal: local variable declarations and type advice
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
"Brian Quinlan" <brian at sweetapp.com> writes: > Paul Rubin wrote: > > [snipped] > > Python has grown from a tiny acorn to a healthy young tree. I believe > > any changes and additions to its design should be made with the idea > > that it may become a mighty oak one day, i.e. that it will have > serious > > native-code optimizing compilers. Language design changes should > work > > toward that goal, or at least not impede it. > > Is optimization the only purpose of your proposals? If that is the case, > they are probably not needed. The Python compiler already identifies > variables that have local-only scope. Presumably other compilers could > do the same. Optimization is one of the goals of type advice. Error checking is another: in an appropriate runtime mode, it's similar to having an assert statement every place the variable is set. Local variable declarations are for code cleanliness. Currently, using some name for a temp variable leaves detritus around after you're done with it. To figure out what the program is doing, you have to check whether further references to 'temp' really wanted the value left from someplace far away, or were holding just a different temporary value. When the usefulness of a variable ends, its scope should also end.
- Previous message (by thread): Proposal: local variable declarations and type advice
- Next message (by thread): Proposal: local variable declarations and type advice
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list