Class Variable Question

D-Man dsh8290 at rit.edu
Mon Apr 16 23:37:16 EDT 2001


On Tue, Apr 17, 2001 at 02:57:05AM +0000, Robert Amesz wrote:
| Well, there's no reason why you can't have declared variables on a 
| function by function basis. Something like:
| 
| def func(x):
|     local y
|     y = 2 * x
|     return y
| 
| The 'local' keyword then would be the counterpart of 'global'. 
...
| Perhaps problems like this should be left to a tool like PyChecker, 
| which can examine multiple related classes simultaneously.

I think this is a really good idea.  The syntax would need to be
changed to have a '#' in front of the declaration.

-D





More information about the Python-list mailing list