Re: Modules and Namespaces

2005-10-20 Thread jelle
Ooops, Larry, forgive me being to overhauled here: Actually self.RS = RS does not make the RS object available in the module, Steve's method does however. -Jelle -- http://mail.python.org/mailman/listinfo/python-list

Re: Modules and Namespaces

2005-10-20 Thread jelle
Dear Steve & Larry, Both your methods worked flawless, thanks to both of you! I have to say Larry's way wins on style points, doens't it? What an awefull thing to get stuck on something that simple, what a gorgeous solution, thanks so much! -Jelle -- http://mail.python.org/mailman/listinfo/pyth

Re: Modules and Namespaces

2005-10-20 Thread Larry Bates
One way is to pass the RS object when you instantiate an instance of srfBase, something like: class srfBase: '''Base class inherited by the srf* classes, binding general Rhino surface functionality to a particular surface generation method''' def __init__(self, RS): self.

Re: Modules and Namespaces

2005-10-20 Thread Steve Holden
Jelle Feringa / EZCT Architecture & Design Research wrote: > ##I'm sorry to stir up such a well discussed topic yet again, but namespaces > are a point of confusion to me... > > I took the effort of organizing my Python code (scripting a cad program > calles Rhino) in well defined classes, which w

Modules and Namespaces

2005-10-20 Thread Jelle Feringa / EZCT Architecture & Design Research
##I'm sorry to stir up such a well discussed topic yet again, but namespaces are a point of confusion to me... I took the effort of organizing my Python code (scripting a cad program calles Rhino) in well defined classes, which would be a terrific thing if I didn't got stuck in namespace issues.

Re: modules and namespaces

2005-04-19 Thread Berthold Höllmann
Laszlo Zsolt Nagy <[EMAIL PROTECTED]> writes: >>However it doesn't work until I import the string module into m1 and m2 >>modules. I found in the manual that imported modules will be searched in >>the container module first. Is it more efficient to import the string >>module into main and m1 and m

Re: modules and namespaces

2005-04-19 Thread Jaime Wyant
Each module has its own "namespace", which is like a dictionary of objects that the module can "see". I use the term dicitionary because locals() and globals() both return dictionaries -- someone may correct me on this (or confirm what I say)... You have local and global variables. Locals are va

Re: modules and namespaces

2005-04-19 Thread Laszlo Zsolt Nagy
However it doesn't work until I import the string module into m1 and m2 modules. I found in the manual that imported modules will be searched in the container module first. Is it more efficient to import the string module into main and m1 and m2 than importing only into m1 and m2? I bet the mos

modules and namespaces

2005-04-19 Thread Mage
Hello, I thought that this will work: #m1.py def f1(): return string.join('a','a') #m2.py def f2(): return string.join('b','b') #main.py import string import m1 import m2 print f1() print f2() - However it doesn't work until I import the string module into m1 and m2 mo