Representation of python code ?

showellshowell at gmail.com showellshowell at gmail.com
Mon Sep 15 10:33:37 EDT 2008


On Sep 15, 7:17 am, Maric Michaud <ma... at aristote.info> wrote:
> Le Monday 15 September 2008 16:06:19 showellshow... at gmail.com, vous avez
> écrit :
>
> > I'm not sure this is the best counterexample.  You can see statically
> > that A potentially creates an instance of the B class.
>
> > > class A :
> > >     def __init__(self) :
> > >          self._b = B()
>
> > > class B : pass
>
> Yes, you can, but are you sure it's obvious that B in A.__init__ is the class
> you think of ?
>

I'm guessing 99% of the time it will be.  It seems to me that if
you're invoking classes in a truly dynamic way, you should be explicit
about it anyway, and give methods some kind of naming convention, like
have "factory" in the name.  This would not only make it easy for a
visualization program not to be tricked, but it would help out your
human readers as well.






More information about the Python-list mailing list