[Uml-devel] [Bug 109909] New: python code generation missing class attributes, init code.
D. Anthony Robinson
anthony at chinstrap.homelinux.net
Sun Jul 31 10:03:55 UTC 2005
Interesting. I was planning on extending the Python code generator, but work
has kept me from doing fun stuff like that. ;)
Some comments below...
> 1) no class attributes generated. Attributes would be
> Class MyClass:
> public_attribute =
> _protected_attribute =
> __private_attribute =
>
> default values would most likely be None, unless otherwise specified
This sounds reasonable to me. Unless anyone else really has the itch to fix
this, I'll start working on it ASAP.
> 3) Class missing...
> if __name__=='__main__':
> MyClass()
>
> This is a very common methodology, especially in testing, perhaps another
> option?
While this is done in many cases, there's plenty of times that it's not
used. Personally, because the use of the __main__ check is very dependent on
what you're doing with the class, I'd say leave this to the decision of the
programmer whether they want it or not.
> 4) Subclasses missing the init function...
> def __init__(self, foobar):
> Super.__init__(self, foobar)
>
> Again optional but there is a greater than 50% chance I would call the
> superclass.
Hmmm.... Not sure about this one. Like 3) above, it's kind of dependent on
exactly what's going on, though it is more likely that you'll need to call
the superclass. Are there any instances you can think of where either
calling the superclass constructor would cause undesired effects, or where
not calling the superclass constructor would cause other problems? If it
comes to a 'depends on the classes' kind of answer, then I'd be more
inclined to leave it alone.
--
D. Anthony Robinson
More information about the umbrello-devel
mailing list