Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #5904

Re: Overuse of try/except/else?

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!feeder.news-service.com!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <prologic@shortcircuit.net.au>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.009
X-Spam-Evidence '*H*': 0.98; '*S*': 0.00; 'raised': 0.07; '21,': 0.09; 'callable': 0.09; 'exception.': 0.09; 'module)': 0.09; 'to:name:python list': 0.09; 'pm,': 0.10; 'exception': 0.12; 'wrote:': 0.14; 'function;': 0.16; 'guess': 0.19; 'header:In- Reply-To:1': 0.21; 'seems': 0.21; 'received:209.85.161.46': 0.23; 'received:mail-fx0-f46.google.com': 0.23; 'runs': 0.23; 'function': 0.25; 'later': 0.26; 'received:209.85.161': 0.26; 'object': 0.26; 'message-id:@mail.gmail.com': 0.28; 'sat,': 0.29; 'subject:?': 0.29; 'facility': 0.29; 'solved': 0.30; 'worker': 0.30; 'calling': 0.31; 'anyone': 0.32; 'cheers': 0.32; 'to:addr :python-list': 0.33; 'subject:/': 0.36; 'received:google.com': 0.37; 'received:209.85': 0.37; 'thread': 0.37; 'think': 0.38; 'subject:: ': 0.38; "i'd": 0.39; 'received:209': 0.39; 'returned': 0.39; 'to:addr:python.org': 0.39; 'more': 0.60; 'your': 0.60; 'dangerous': 0.65; 'cameron': 0.73; 'catches': 0.84; 'subject:try': 0.84
MIME-Version 1.0
In-Reply-To <20110521054020.GA32313@cskk.homeip.net>
References <BANLkTikAZbUxnqA2o-Gu439Vn44P_mFeZA@mail.gmail.com> <20110521054020.GA32313@cskk.homeip.net>
From James Mills <prologic@shortcircuit.net.au>
Date Sat, 21 May 2011 17:08:18 +1000
Subject Re: Overuse of try/except/else?
To python list <python-list@python.org>
Content-Type text/plain; charset=UTF-8
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.1875.1305961727.9059.python-list@python.org> (permalink)
Lines 18
NNTP-Posting-Host 82.94.164.166
X-Trace 1305961727 news.xs4all.nl 49180 [::ffff:82.94.164.166]:60382
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:5904

Show key headers only | View raw


On Sat, May 21, 2011 at 3:40 PM, Cameron Simpson <cs@zip.com.au> wrote:
> These days I think I'd use a LateFunction (a facility of my own which is
> a lot like the futures module) which returns a callable when you submit
> a function; the worker thread runs the submitted function and catches the
> return value or raised exception. Anyone who calls the returned callable
> later gets the return value or the exception reraised as appropriate,
> so one can avoid the dangerous "catch everything and log" scenario.

I like this :) I guess you call this a Proxy Object although
your calling it a LateFunction seems more "fitting" :)

cheers
James

-- 
-- James Mills
--
-- "Problems are solved by method"

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: Overuse of try/except/else? James Mills <prologic@shortcircuit.net.au> - 2011-05-21 17:08 +1000

csiph-web