variable declaration

Jeff Shannon jeff at ccvcorp.com
Tue Feb 8 15:41:12 EST 2005


Alexander Zatvornitskiy wrote:

> Another example. Let say you have variable PowerOfGenerator in your program.
> But, it is only active power, so you have to (1)rename PowerOfGenerator to
> ActivePowerOfGenerator, (2)calculate ReactivePowerOfGenerator, and (3)calculate
> new PowerOfGenerator by formula
>   PowerOfGenerator=sqrt(ReactivePowerOfGenerator**2+ActivePowerOfGenerator**2)
> With var declarations, on step (1) you just rename PowerOfGenerator to
> ActivePowerOfGenerator in the place of its declaration, and compile your
> program. Compiler will show you all places where you have to rename variables.
> After it, on step (3) you can safely and peacefully add new PowerOfGenerator
> variable.

You can also get all places where said variable exists by using grep, 
or your editor's search feature.  I don't see how a var declaration 
gains you anything over 'grep PowerOfGenerator *.py' ...

Jeff Shannon
Technician/Programmer
Credit International





More information about the Python-list mailing list