[Zope] calling another products methods

Terry Hancock hancock at anansispaceworks.com
Tue Dec 2 16:47:39 EST 2003


On Tuesday 02 December 2003 02:37 pm, J Cameron Cooper wrote:
> Terry Hancock wrote:
> >On Tuesday 02 December 2003 12:59 pm, Dylan Reinhardt wrote:
> >>from Products.P1.p1module import p1class

> >I can attest that this works.  I use it a *lot*,  [...]
> > I have not found any equivalent to "../" in the way
> >Python imports modules, so I can't just "go up a directory".
> >Is there one, BTW?
> >  
> As I recall, this was explicitly rejected from Python for some reason.

Probably because it's "implicit".  And potentially would interfere with
moving the module/package.

> I suppose you can abstract it a bit by creating, say, a module 'parent' in 
> your current package and importing the names present in the directory 
> above: 'from Products.MyProduct import *'. Then you can 'from parent 
> import SomeBasicClass'.

Truthfully, it's not so objectionable to do it the way I'm doing it.  I just
wonder sometimes whether I'm going the long-way-round.

In college, I was asked how to compute the distance between two
stars in my astronomy lab class.  I replied with an explanation
about measuring the RA and Dec separations off the reticle and
then using the sqrt(ra^2 + dec^2) to get the result.

To which my instructor replied "Or, you could just turn the reticle."

I learned a lesson that night.

Cheers,
Terry

--
Terry Hancock ( hancock at anansispaceworks.com )
Anansi Spaceworks  http://www.anansispaceworks.com



More information about the Zope mailing list