Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #35136
| Path | csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!ecngs!feeder2.ecngs.de!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <rosuav@gmail.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; 'exception': 0.03; 'context': 0.05; 'caller': 0.07; 'parameter': 0.07; 'accordingly.': 0.13; 'dec': 0.15; 'expression,': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'ignored,': 0.16; 'traceback.': 0.16; 'wrote:': 0.17; 'specifies': 0.17; 'thu,': 0.17; 'variable': 0.20; 'header:In-Reply-To:1': 0.25; 'am,': 0.27; 'checking': 0.27; 'message-id:@mail.gmail.com': 0.27; "doesn't": 0.28; 'all.': 0.28; 'environment': 0.29; 'function': 0.30; 'code': 0.31; 'anywhere': 0.33; 'traceback': 0.33; 'to:addr:python-list': 0.33; "can't": 0.34; 'received:google.com': 0.34; 'whatever': 0.35; 'received:209.85': 0.35; 'there': 0.35; 'but': 0.36; 'method': 0.36; 'possible': 0.37; 'being': 0.37; 'passed': 0.37; 'received:209': 0.37; 'subject:: ': 0.38; 'object': 0.38; 'some': 0.38; 'to:addr:python.org': 0.39; 'easily': 0.39; 'header:Received:5': 0.40; 'think': 0.40; 'your': 0.60; 'matter': 0.61; 'first': 0.61; 'more': 0.63; '20,': 0.65; 'interest.': 0.78; 'off,': 0.84; 'thing,': 0.84 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=n8j2T0tnHWUDz+SKhb7gf921wFOZ0jtUHjVEPkWPFgA=; b=QEbaqqVR5z5csijJEftY4D78bAf9+XrEshy175Ce1RDysNgUY7OYS2zq7M+c4qsVo+ vNKuzPa6teYW+QGJlbbALoeiLRGCc2Wr9ZNA5hot8Tv44GX0EzyM2pe6M2CoJTvxJx0w VUkRf4D1vFuVFj4wXOFZtttd9akgyDjDTJtsjqoBFoUsq7MEicyLYY2gTCb1ZUZI5voJ 6DaQmOYp8MNvmD6NVzNSSdyw+Fbmg4mYtpx1yCZDkeUwJ4T3OcAyoGCxT/m7L7nnCBTa EzE/EIZh9R/VmEIA7QPFdS4hGs4LFK4dBzrPzzc4G/d1YVfjO13S8Qim8LRvmVA1v7Hk mg7A== |
| MIME-Version | 1.0 |
| In-Reply-To | <CADPXuAgW5uMRhNomqbLmnXKMuhxb6WzSnFsEjJCp-MX1WZK9pw@mail.gmail.com> |
| References | <CADPXuAgW5uMRhNomqbLmnXKMuhxb6WzSnFsEjJCp-MX1WZK9pw@mail.gmail.com> |
| Date | Thu, 20 Dec 2012 03:07:56 +1100 |
| Subject | Re: context aware execution |
| From | Chris Angelico <rosuav@gmail.com> |
| To | python-list@python.org |
| Content-Type | text/plain; charset=ISO-8859-1 |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| 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.1059.1355933279.29569.python-list@python.org> (permalink) |
| Lines | 30 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1355933280 news.xs4all.nl 6897 [2001:888:2000:d::a6]:60715 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:35136 |
Show key headers only | View raw
On Thu, Dec 20, 2012 at 2:57 AM, Bart Thate <feedbackflow@gmail.com> wrote: > Hi All ! > > Is is possible and if yes, is it more easily possible (i am thinking f_back > maybe) to get the context of the caller when in a function ? > > Like to which variable name is this object assigned ? > > Or whatever of the callers context that might be of interest. > > I want in a function or method determine the context of my caller and adapt > the functionality accordingly. First off, please don't! Your code will be *extremely* confusing. You can find out what function is calling you, eg by throwing an exception and checking the traceback. My 3AM brain can't think of a way to get the current thread's traceback without throwing, but there may well be a way. (I also don't know of a way to get any other thread's traceback, but that doesn't matter to this discussion.) But finding out what variable name your return value is to be assigned to isn't possible at all. For one thing, it might not be assigned anywhere - it might be being ignored, or it might be used in some other expression, or anything. Usually, the best way to adapt to your caller's environment is to be passed a parameter that specifies the change. ChrisA
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: context aware execution Chris Angelico <rosuav@gmail.com> - 2012-12-20 03:07 +1100
csiph-web