Re: Function getting a reference to its own module

2008-09-17 Thread Carl Banks
On Sep 16, 10:29 pm, Steven D'Aprano <[EMAIL PROTECTED]> wrote: > On Wed, 17 Sep 2008 13:52:13 +1200, greg wrote: > > Arnaud Delobelle wrote: > > >> Or: > > >> import ModuleName as this_module > > > Or: > > > this_module = __import__(__name__) > > > then you don't have to change anything. > > I lik

Re: Function getting a reference to its own module

2008-09-16 Thread Steven D'Aprano
On Wed, 17 Sep 2008 13:52:13 +1200, greg wrote: > Arnaud Delobelle wrote: > >> Or: >> >> import ModuleName as this_module > > Or: > > this_module = __import__(__name__) > > then you don't have to change anything. I like that solution! And it works regardless of whether the module holding i

Re: Function getting a reference to its own module

2008-09-16 Thread greg
Arnaud Delobelle wrote: Or: import ModuleName as this_module Or: this_module = __import__(__name__) then you don't have to change anything. -- Greg -- http://mail.python.org/mailman/listinfo/python-list

Re: Function getting a reference to its own module

2008-09-14 Thread Arnaud Delobelle
On Sep 14, 5:10 pm, "Aaron \"Castironpi\" Brady" <[EMAIL PROTECTED]> wrote: > On Sep 14, 4:43 am, Arnaud Delobelle <[EMAIL PROTECTED]> wrote: > > > > > On Sep 14, 10:29 am, Steven D'Aprano <[EMAIL PROTECTED] > > > cybersource.com.au> wrote: > > > I have a function that needs a reference to the modu

Re: Function getting a reference to its own module

2008-09-14 Thread Aaron "Castironpi" Brady
On Sep 14, 4:43 am, Arnaud Delobelle <[EMAIL PROTECTED]> wrote: > On Sep 14, 10:29 am, Steven D'Aprano <[EMAIL PROTECTED] > > > > cybersource.com.au> wrote: > > I have a function that needs a reference to the module object it is > > defined in. (For the reason why, if you care, see the thread "doct

Re: Function getting a reference to its own module

2008-09-14 Thread Arnaud Delobelle
On Sep 14, 10:29 am, Steven D'Aprano <[EMAIL PROTECTED] cybersource.com.au> wrote: > I have a function that needs a reference to the module object it is > defined in. (For the reason why, if you care, see the thread "doctest not > seeing any of my doc tests" from a week ago.) I know of two ways to