Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #96293
| Path | csiph.com!eternal-september.org!feeder.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail |
|---|---|
| From | Paul Rubin <no.email@nospam.invalid> |
| Newsgroups | comp.lang.python |
| Subject | Re: Context-aware return |
| Date | Thu, 10 Sep 2015 12:19:59 -0700 |
| Organization | A noiseless patient Spider |
| Lines | 10 |
| Message-ID | <87twr2rsio.fsf@jester.gateway.pace.com> (permalink) |
| References | <55f1c3c6$0$1659$c3e8da3$5496439d@news.astraweb.com> |
| Mime-Version | 1.0 |
| Content-Type | text/plain |
| Injection-Info | mx02.eternal-september.org; posting-host="3a9ed331cf606b0b072b7def4034f06f"; logging-data="20587"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18DL8KjGOuRGQ/T6SjKykNy" |
| User-Agent | Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) |
| Cancel-Lock | sha1:SOEPP6MjruB9Z2SwUUaBRu6tlPQ= sha1:I7p+1ry/3BBoUrrX6Itl1rrnCg8= |
| Xref | csiph.com comp.lang.python:96293 |
Show key headers only | View raw
Steven D'Aprano <steve@pearwood.info> writes: > I want the function to know its own context. > I don't mind if it is CPython only, or if it is a bit expensive. That sounds crazy but if it's really what you want, you can probably fake it by examining the control stack using the backtrace module. I remember doing some hack of raising and catching an exception in order to retrieve the backtrace, but there might be a cleaner way that I didn't bother researching since it was just for a quick debugging problem.
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Context-aware return Steven D'Aprano <steve@pearwood.info> - 2015-09-11 03:54 +1000
Re: Context-aware return "Sven R. Kunze" <srkunze@mail.de> - 2015-09-10 20:03 +0200
Re: Context-aware return Ben Finney <ben+python@benfinney.id.au> - 2015-09-11 04:12 +1000
Re: Context-aware return Ben Finney <ben+python@benfinney.id.au> - 2015-09-11 04:14 +1000
Re: Context-aware return "Sven R. Kunze" <srkunze@mail.de> - 2015-09-10 20:21 +0200
Re: Context-aware return "Sven R. Kunze" <srkunze@mail.de> - 2015-09-10 20:24 +0200
Re: Context-aware return "Sven R. Kunze" <srkunze@mail.de> - 2015-09-10 20:34 +0200
Re: Context-aware return Chris Angelico <rosuav@gmail.com> - 2015-09-11 04:39 +1000
Re: Context-aware return Laura Creighton <lac@openend.se> - 2015-09-10 20:40 +0200
Re: Context-aware return "Sven R. Kunze" <srkunze@mail.de> - 2015-09-10 20:45 +0200
Re: Context-aware return "Sven R. Kunze" <srkunze@mail.de> - 2015-09-10 20:56 +0200
Re: Context-aware return Paul Rubin <no.email@nospam.invalid> - 2015-09-10 12:19 -0700
Re: Context-aware return Grant Edwards <invalid@invalid.invalid> - 2015-09-10 19:23 +0000
Re: Context-aware return Akira Li <4kir4.1i@gmail.com> - 2015-09-10 23:15 +0300
Re: Context-aware return Grant Edwards <invalid@invalid.invalid> - 2015-09-10 20:27 +0000
Re: Context-aware return random832@fastmail.us - 2015-09-10 16:42 -0400
Re: Context-aware return Rustom Mody <rustompmody@gmail.com> - 2015-09-11 08:55 -0700
Re: Context-aware return Rustom Mody <rustompmody@gmail.com> - 2015-09-11 08:55 -0700
Re: Context-aware return Denis McMahon <denismfmcmahon@gmail.com> - 2015-09-11 00:41 +0000
Re: Context-aware return Ned Batchelder <ned@nedbatchelder.com> - 2015-09-12 16:27 -0700
Re: Context-aware return Steven D'Aprano <steve@pearwood.info> - 2015-09-17 12:31 +1000
Re: Context-aware return Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-09-12 03:11 +0100
csiph-web