Re: [Python-Dev] Dynamic module namspaces

2006-07-17 Thread glyph
On Mon, 17 Jul 2006 10:29:22 -0300, Johan Dahlin <[EMAIL PROTECTED]> wrote: >I consider __getattribute__ a hack, being able to override __dict__ is less >hackish, IMHO. Why do you feel one is more "hackish" than the other? In my experience the opposite is true: certain C APIs expect __dict__ to

Re: [Python-Dev] Dynamic module namspaces

2006-07-17 Thread Johan Dahlin
Phillip J. Eby wrote: > Just as a point of reference, the Importing package does something very > similar, to support "weak" and "lazy" imports: > > http://cheeseshop.python.org/pypi/Importing Interesting, I was not aware of that, thanks for the pointer. Another reason for including this feature

Re: [Python-Dev] Dynamic module namspaces

2006-07-17 Thread Johan Dahlin
James Y Knight wrote: > > On Jul 15, 2006, at 2:38 PM, Johan Dahlin wrote: >> What I want to ask, is it possible to have a sanctioned way to implement >> a dynamic module/namespace in python? >> >> For instance, it could be implemented to allow you to replace the >> __dict__ attribute in a module

Re: [Python-Dev] Dynamic module namspaces

2006-07-17 Thread Johan Dahlin
Andrew Bennetts wrote: > On Sat, Jul 15, 2006 at 03:38:04PM -0300, Johan Dahlin wrote: >> In an effort to reduce the memory usage used by GTK+ applications >> written in python I've recently added a feature that allows attributes >> to be lazy loaded in a module namespace. The gtk python module c

Re: [Python-Dev] Dynamic module namspaces

2006-07-17 Thread Andrew Bennetts
On Sun, Jul 16, 2006 at 11:52:48PM -0700, Josiah Carlson wrote: > Andrew Bennetts <[EMAIL PROTECTED]> wrote: [...] > > > > Have you seen the "demandload" hack that Mercurial uses? You can find it > > here: > > http://selenic.com/repo/hg?f=cb4715847a81;file=mercurial/demandload.py > > > > Yo

Re: [Python-Dev] Dynamic module namspaces

2006-07-16 Thread Josiah Carlson
Andrew Bennetts <[EMAIL PROTECTED]> wrote: > On Sat, Jul 15, 2006 at 03:38:04PM -0300, Johan Dahlin wrote: > > In an effort to reduce the memory usage used by GTK+ applications > > written in python I've recently added a feature that allows attributes > > to be lazy loaded in a module namespace.

Re: [Python-Dev] Dynamic module namspaces

2006-07-16 Thread Andrew Bennetts
On Sat, Jul 15, 2006 at 03:38:04PM -0300, Johan Dahlin wrote: > In an effort to reduce the memory usage used by GTK+ applications > written in python I've recently added a feature that allows attributes > to be lazy loaded in a module namespace. The gtk python module contains > quite a few attri

Re: [Python-Dev] Dynamic module namspaces

2006-07-16 Thread James Y Knight
On Jul 15, 2006, at 2:38 PM, Johan Dahlin wrote: > What I want to ask, is it possible to have a sanctioned way to > implement > a dynamic module/namespace in python? > > For instance, it could be implemented to allow you to replace the > __dict__ attribute in a module with a user provided object

Re: [Python-Dev] Dynamic module namspaces

2006-07-15 Thread Phillip J. Eby
At 03:38 PM 7/15/2006 -0300, Johan Dahlin wrote: >In an effort to reduce the memory usage used by GTK+ applications >written in python I've recently added a feature that allows attributes >to be lazy loaded in a module namespace. The gtk python module contains >quite a few attributes (around 850) o

Re: [Python-Dev] Dynamic module namspaces

2006-07-15 Thread Giovanni Bajo
Johan Dahlin wrote: > My point is that I consider this to be a valid use case, the amount of > saved memory is significan, and I could not find another way of doing > it and still keep the gtk interface (import gtk; gtk.Button) to still be > backwards compatible. You may want to have a look at SI

[Python-Dev] Dynamic module namspaces

2006-07-15 Thread Johan Dahlin
In an effort to reduce the memory usage used by GTK+ applications written in python I've recently added a feature that allows attributes to be lazy loaded in a module namespace. The gtk python module contains quite a few attributes (around 850) of which many are classes or interfaces (150+) Th