Re: getattr for modules not classes

2006-05-27 Thread Piet van Oostrum
> Heiko Wundram <[EMAIL PROTECTED]> (HW) schreef: >HW> from x import test as x >HW> print x.one >HW> print x.two >HW> print x.three Or replace test by x in x.py :=) -- Piet van Oostrum <[EMAIL PROTECTED]> URL: http://www.cs.uu.nl/~piet [PGP 8DAE142BE17999C4] Private email: [EMAIL PROTECTED]

Re: getattr for modules not classes

2006-05-26 Thread Heiko Wundram
Am Mittwoch 24 Mai 2006 15:43 schrieb Piet van Oostrum: > > Heiko Wundram <[EMAIL PROTECTED]> (HW) wrote: > > > >HW> y.py > >HW> --- > >HW> from x import test > >HW> print test.one > >HW> print test.two > >HW> print test.three > >HW> --- > > Or even: > import x > x = x.test > print x.one > prin

Re: getattr for modules not classes

2006-05-24 Thread Piet van Oostrum
> Heiko Wundram <[EMAIL PROTECTED]> (HW) wrote: >HW> y.py >HW> --- >HW> from x import test >HW> print test.one >HW> print test.two >HW> print test.three >HW> --- Or even: import x x = x.test print x.one print x.two print x.three -- Piet van Oostrum <[EMAIL PROTECTED]> URL: http://www.cs.uu.

Re: getattr for modules not classes

2006-05-22 Thread Daniel Nogradi
> > Is there something analogous to __getattr__ for modules? > > > > I know how to create a class that has attributes from a list and > > nothing else by overloading __getattr__ and making sure that the > > accessed attribute appears in my list. Now I would like to do the same > > with a module, sa

Re: getattr for modules not classes

2006-05-21 Thread Heiko Wundram
Am Sonntag 21 Mai 2006 21:52 schrieb Daniel Nogradi: > Is there something analogous to __getattr__ for modules? > > I know how to create a class that has attributes from a list and > nothing else by overloading __getattr__ and making sure that the > accessed attribute appears in my list. Now I woul

getattr for modules not classes

2006-05-21 Thread Daniel Nogradi
Is there something analogous to __getattr__ for modules? I know how to create a class that has attributes from a list and nothing else by overloading __getattr__ and making sure that the accessed attribute appears in my list. Now I would like to do the same with a module, say x.py, in which I have