> A typical repr from the demo is:
>
> class complex:
> ..
> def __repr__(self):
> return 'complex' + `self.re, self.im`
>
> To be able to create the object from it's repr implies that instead of
> "import complex" you need to do "from complex import *". Is that pretty
In general, it is relativ bad to do an "from xxx import *" cause it
bind's you rather tightly to the xxx. More it would be better to be
able to rename anything while importing. But shouldn't matter here.
> much standard practice, or would it make sense for repr to reference it's
> module?
>
> def __repr__(self):
> return 'complex.complex' + `self.re, self.im`
So it's better this way. (Even if I don't know if it is correct:-)
But the __*__ functions are a problem at all. Both for a lot of
practical discussion and theoretical questions.
They serve a hidden role to break the strict rules of the OO-paradigm
cause there are cases where it is hard or impossible to code what you
want as OO. For more refer my RFC some day's ago or mail me.
------------------------------------------------------------------------------- Joerg Wittenberger Rietzstr. 32b 01139 Dresden Germany
email: jw@ibch50.inf.tu-dresden.de jw6@mail.inf.tu-dresden.de
WWW: <a href=http://www.inf.tu-dresden.de:8002/people/jw6/top.html>jerry</a>
PGP PUBLIC KEY: available on request or by finger