Automatic Generation of Python Class Files
Diez B. Roggisch
deets at nospam.web.de
Mon Oct 22 14:44:21 EDT 2007
> You wrote: " can't think of a single reason why you would ever want to
> do this,
> since your "list of method and property names" would be just as
> verbose as just typing the actual python code."
>
> I don't think I understand how this would be the same amount of
> typing. Consider the following example that would generate a Monster
> class file from an input text file (I only did one property and method
> in generated class file.):
>
> Contents of input text file:
>
> [Name]
> Fire Breathing Dragon
>
> [Properties]
> Strength
> Scariness
> Endurance
>
> [Methods]
> eatMaiden argMaiden
> fightKnight argKnight
Others have already given you reasons why that is a bad idea. Another
one is this: how do you deal with changes to your generated classfile?
It's complicated to ensure that you don't override modified code with
generated.
Diez
More information about the Python-list
mailing list