class checking its own module for an attribute
rodperson at rodperson.com
Wed Mar 21 18:06:55 CET 2012
On Wed, 21 Mar 2012 09:56:57 -0700
Chris Rebert <clp2 at rebertia.com> wrote:
> On Wed, Mar 21, 2012 at 8:25 AM, Rod Person <rodperson at rodperson.com>
> wrote: <snip>
> > The question is there a way I can do this with out having to import
> > constants when what it's doing is importing itself. It would seem
> > to me that there should be a way for a module to reference itself.
> > In that thinking I have tried
> > if not(hasattr(__file__, value):
> > if not(hasattr(__name__, value):
> > and even:
> > this = sys.argv
> > if not(hasattr(this, value):
> > None of which works.
Rod Person http://www.rodperson.com rodperson at rodperson.com
'Silence is a fence around wisdom'
More information about the Python-list