Class Variable Question
Robert Amesz
rcameszREMOVETHIS at dds.removethistoo.nl
Wed Apr 18 21:02:16 EDT 2001
D-Man wrote:
>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.
That wouldn't be a syntax change, that's just a way of making it into a
comment, which PyChecker could parse. The original discussion was about
adding declarations to Python itself.
Not that I'm saying that such a directive wouldn't be useful: it would
be the next best thing to having real declarations.
Robert Amesz
More information about the Python-list
mailing list