|
From: Joerg L. <jo...@us...> - 2002-02-26 16:49:55
|
On 26.02.02, Andre Wobst wrote:
> > Yes, that's true. But maybe we can use a hack, which stores the base=20
> > unit globally (as a static property of the unit class). Isn't
> > something like that possible in Python 2.2?
>=20
> I don't think its related to Python 2.2. Such a construction is
> available all the time --- or maybe I have misunderstood you. Do you
> mean something like this:
You're right , that' of course already possible. New in Python 2.2 are
so called static methods. And of course metaclasses, but probably we
don't need them. They would at least allow something like
u1=3Dunit.unit(scale=3D...)
u2=3Dunit.unit(scale=3D...)
moveto(u1("..."), u2("..."))
but still the default unit would be the same. So this is probably
not a good idea.
> It might be natural (I feel quite sure), that we then do have a global
> unit variable. For the moment, we don't have it and therefore run into
> the troubles you talked about. We may know just decide, what to do. I
> would say, that it is ok. Even so, there is a way out by doing:
I also think, that we should do it like that and drop our present
scheme. It's really too complicated and the user gains not very much
from it.
>=20
> import pyx as pyx1
> import pyx as pyx2
>=20
> Whenever you use now pyx1, you should be able to access the pyx1
> global defaultunit, whereas you do the same within pyx2. I haven't
> tried it (have never done something like that), but hopefully this is
> possible. The key for doing so, is that the lineto for example doesn't
> just look for pyx.unit.defaultunit, but for self.???.unit.defaultunit.
> The question is, if all that is available in the modules namespace
> somehow. But I guess so. We should try it. It would be a nice starting
> point for writing a arg.tex like proposal on units ...
I'm not quite sure, whether something like this would work, but
however, this is IMHO not that important. Usually you just want one scali=
ng
of the units at any time.=20
Ok, to conclude this thread from my side, I would suggest that we drop
unit in canvas pretty soon. Any objections?
J=F6rg=20
|