Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #21991
| Path | csiph.com!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder2.enfer-du-nord.net!newsfeed.eweka.nl!eweka.nl!feeder3.eweka.nl!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <chris@rebertia.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.014 |
| X-Spam-Evidence | '*H*': 0.97; '*S*': 0.00; 'subject:module': 0.04; 'rod': 0.07; '21,': 0.09; 'am,': 0.12; 'constants': 0.16; 'sys.argv[0]': 0.16; '\xc2\xa0if': 0.16; 'cc:addr:python-list': 0.16; 'wed,': 0.17; 'wrote:': 0.18; 'cheers,': 0.20; 'header:In- Reply-To:1': 0.22; 'works.': 0.23; 'received:209.85.220': 0.25; 'cc:2**0': 0.26; 'module': 0.26; 'import': 0.27; 'tried': 0.27; 'message-id:@mail.gmail.com': 0.29; 'importing': 0.29; 'cc:addr:python.org': 0.29; 'seem': 0.29; 'chris': 0.30; 'there': 0.33; 'none': 0.35; 'question': 0.36; 'reference': 0.37; 'received:google.com': 0.37; 'received:209.85': 0.38; 'doing': 0.38; 'should': 0.38; 'itself.': 0.39; 'received:209': 0.39; 'sender:addr:chris': 0.84; 'subject:its': 0.84; 'value):': 0.84; 'subject:own': 0.91 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=rebertia.com; s=google; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=7D4DTLLaPI5hd4pARJoOmEeCVitXA9tcsqxv/z6+q5s=; b=S5ZSyLfK3rVLo4N7KX6Owrc6qu++Y1+poNTwemJZrQhrSxRkOsfQXfWIaRcHhQFSQ8 ory5kxTT5C8xrsC1IHH5dDEMpIKxd1TF6Rg8Bcc6N4ZgJBYHa0VV7NGuRsxzKhYU9Sz+ PezMShuun5UPFYDA5LtioZjE3gJA4bc3uxRJM= |
| X-Google-DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding:x-gm-message-state; bh=7D4DTLLaPI5hd4pARJoOmEeCVitXA9tcsqxv/z6+q5s=; b=ifGlqT1C0JPJXjZKTKFs/HvhoyqtcfeD+sz74vIlOeRJa8gGJPNbOvqVtH2ZuG3Lda up7r3kDWEJxHferKMFOvd4SevZ+lwfUqO0ntMUwak4IhA9FJkgDpoHDTEsD8sZR7JBWz slMFO7Gu+2V2eQJFubdeSRa8teBcq/by1M537WDbhlvsY+PteOZnUuzADNSx10PlT0I3 NfYYbklLLkm4kbL0dJt/Wb7Jg50ykfq063xrXbxQLjD9w1ziRqp0YmiUpho9jnHmH86D I6+38Kdi37HupYHTrFmvqWaB9p4MH5GYw2RCRTWbMZwPm1IjcdodHZUEiH2vhv1L7srO ls8g== |
| MIME-Version | 1.0 |
| Sender | chris@rebertia.com |
| In-Reply-To | <20120321112503.00006eb5@unknown> |
| References | <20120321112503.00006eb5@unknown> |
| Date | Wed, 21 Mar 2012 09:56:57 -0700 |
| X-Google-Sender-Auth | wlP1Zy4u-cmabfNqeNBZu0naGF0 |
| Subject | Re: class checking its own module for an attribute |
| From | Chris Rebert <clp2@rebertia.com> |
| To | Rod Person <rodperson@rodperson.com> |
| Content-Type | text/plain; charset=UTF-8 |
| Content-Transfer-Encoding | quoted-printable |
| X-Gm-Message-State | ALoCoQl6kaNPDwQOhE67m/bobBokQ3W4MecQ/h4BXmYGPOWgJmGlq2wYEw+yV3AivIF68bMxpx1d |
| Cc | "python-list@python.org" <python-list@python.org> |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.12 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.864.1332349021.3037.python-list@python.org> (permalink) |
| Lines | 23 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1332349021 news.xs4all.nl 6900 [2001:888:2000:d::a6]:42044 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:21991 |
Show key headers only | View raw
On Wed, Mar 21, 2012 at 8:25 AM, Rod Person <rodperson@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[0] > if not(hasattr(this, value): > > None of which works. http://stackoverflow.com/questions/2933470/how-do-i-call-setattr-on-the-current-module Cheers, Chris
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: class checking its own module for an attribute Chris Rebert <clp2@rebertia.com> - 2012-03-21 09:56 -0700
csiph-web