empty classes as c structs?
Alex Martelli
aleaxit at yahoo.com
Wed Feb 9 08:14:25 EST 2005
Nick Coghlan <ncoghlan at iinet.net.au> wrote:
> Alex Martelli wrote:
> > One thing I'd like to see in namespaces is _chaining_ -- keeping each
> > namespace separate but having lookups proceed along the chain. (The
> > best semantics for _bindings_ as opposed to lookups isn't clear though).
>
> Hmm, so if it doesn't find it in the current namespace, it looks in the
> parent?
Yep.
> For bindings, you could just go with standard Python semantics - normal
> name binding always happens in the innermost scope, so binding a name in a
> namespace should happen in the directly referenced namespace. Then you can
> shadow names from outer scopes, and later regain access to them using
> 'del'.
...which you can't do in "standard Python semantics" - if a name is
local, it's local throughout. You can't do that with a namespace
object, which is why I think the best semantics for bindings in that
case isn't all that clear.
Alex
More information about the Python-list
mailing list