Re: Confused about namespaces

2005-11-19 Thread Alex Martelli
KvS <[EMAIL PROTECTED]> wrote: > Thanks a lot for all the answers. After rereading everything said here > today it's become more clear to me what you guys are telling me and > I'll actively try to forget about "from ... import *" ;). I commend you for your decision. It's a construct that I somet

Re: Confused about namespaces

2005-11-19 Thread KvS
Thanks a lot for all the answers. After rereading everything said here today it's become more clear to me what you guys are telling me and I'll actively try to forget about "from ... import *" ;). -- http://mail.python.org/mailman/listinfo/python-list

Re: Confused about namespaces

2005-11-19 Thread Bruno Desthuilliers
KvS a écrit : > Ok, makes sense but didn't seem "natural" to me, It will seem more natural if you understand that modules should be modulars (ie: low coupling, high cohesion). A module should *never* bother about no rely upon other modules being imported by the module it imports itself. Err, n

Re: Confused about namespaces

2005-11-18 Thread Alex Martelli
KvS <[EMAIL PROTECTED]> wrote: > > There's no reason not to just "import wx" if you want that. > > Yes, that's clear. But if you would make some huge application that has > a large number of nested modules, each importing the former one, then > avoiding the use of "from ... import *" would mean t

Re: Confused about namespaces

2005-11-18 Thread Diez B. Roggisch
> Am I understanding correctly that if you have a module foo importing wx > and a module main importing both foo and wx there are actually two > instances of wx created, one referenced to by (at top level) foo.wx.* > and one wx.*? If this is indeed the case it isn't too good for the > performance

Re: Confused about namespaces

2005-11-18 Thread KvS
> There's no reason not to just "import wx" if you want that. Yes, that's clear. But if you would make some huge application that has a large number of nested modules, each importing the former one, then avoiding the use of "from ... import *" would mean that you have to use long references like f

Re: Confused about namespaces

2005-11-18 Thread Chris Mellon
On 18 Nov 2005 16:09:44 -0800, KvS <[EMAIL PROTECTED]> wrote: > Hmm. But actually I was doing this import from GUIclasses with exactly > this in mind, namely that it would make wx also available at top level. There's no reason not to just "import wx" if you want that. > I (in my naive understandi

Re: Confused about namespaces

2005-11-18 Thread KvS
Hmm. But actually I was doing this import from GUIclasses with exactly this in mind, namely that it would make wx also available at top level. I (in my naive understanding) see this as "natural" and actually desirable, how could this cause confusing bugs? Do you mean multiple "from ... import *"'s

Re: Confused about namespaces

2005-11-18 Thread Chris Mellon
On 18 Nov 2005 15:29:43 -0800, KvS <[EMAIL PROTECTED]> wrote: > Ok, makes sense but didn't seem "natural" to me, although it is an > obvious consequence of what you just pointed out, namely that modules > are evaluated in their own namespace, something to keep in mind... On > the other hand it does

Re: Confused about namespaces

2005-11-18 Thread KvS
Ok, makes sense but didn't seem "natural" to me, although it is an obvious consequence of what you just pointed out, namely that modules are evaluated in their own namespace, something to keep in mind... On the other hand it does apparently work recursively "the other way around" since I didn't exp

Re: Confused about namespaces

2005-11-18 Thread Chris Mellon
On 18 Nov 2005 15:04:23 -0800, KvS <[EMAIL PROTECTED]> wrote: > Hi all, > > to start with, excuse me, I'm still learning programming alltogether, > probably I'm making some fundamental mistake here... > > I have the files settings.py, GUIclasses.py and main.py in the same > directory. In the file m

Confused about namespaces

2005-11-18 Thread KvS
Hi all, to start with, excuse me, I'm still learning programming alltogether, probably I'm making some fundamental mistake here... I have the files settings.py, GUIclasses.py and main.py in the same directory. In the file main.py are the statements: import settings from GUIclasses import * clas