namespaces

Paolino paolo_veronelli at tiscali.it
Wed Aug 10 13:05:34 CEST 2005


Bengt Richter wrote:


> Another thought/bf would be a way to extend the attribute namespace of an arbitrary object
> by chaining the attribute name spaces of a sequence of objects (this would be a language mod)
> e.g., (sort of a dynamic instance attribute mixin)
> 
>      obj ..= a, b, c  # a sequence of objects
> 
> then
> 
>      obj.x  # looks for obj.x, then a.x then b.x then c.x before giving up with attribute error
>      obj ..=()  # clears chained attribute name space ?
> 

Something like a __lookup__ attribute for all instances which are 
namespaces.
Are all objects namespaces or have all objects a namespace?

Also syntax:
  lookup(obj).append(x)

I suppose bound methods will not be found,but in that case some tolerant 
unbound methods could do,naturally if the PEP on eliminating them will 
be accepted.That check they do on the first parameter they push in the 
function (aka 'self')  is really contrasting dinamycal Python IMO.

> Then you could add a property to the namespace of a module by adding an object whose class defines
> the property, like
> 
>      mod ..= objhavingproperty # same tuple ambiguity as with 'somestr' % x
> 
> something analogous to += on immutables would have to be done for builtin objects I suppose.
This is a little hard for me.Has it something to do with extensions also?

Regards Paolino

	

	
		
___________________________________ 
Yahoo! Mail: gratis 1GB per i messaggi e allegati da 10MB 
http://mail.yahoo.it



More information about the Python-list mailing list