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


Groups > comp.lang.python > #17390

Re: Making the case for "typed" lists/iterators in python

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <python-python-list@m.gmane.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.000
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'debug': 0.03; 'predefined': 0.05; 'received:verizon.net': 0.07; 'terry': 0.07; 'transform': 0.07; 'decorator': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:80.91.229.12': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'received:lo.gmane.org': 0.09; 'subject:python': 0.10; 'intermediate': 0.15; 'reedy': 0.16; 'roy': 0.16; 'should.': 0.16; 'subject:case': 0.16; 'temp': 0.16; 'wrote:': 0.18; 'jan': 0.19; 'header:In-Reply-To:1': 0.22; 'code.': 0.26; 'module': 0.26; "i'm": 0.26; 'function': 0.27; 'subject:" ': 0.28; 'explicit': 0.29; 'skip:b 20': 0.29; 'pm,': 0.29; 'does': 0.32; 'in:': 0.32; 'header:User-Agent:1': 0.33; 'header:X-Complaints-To:1': 0.33; 'to:addr:python-list': 0.34; 'something': 0.35; 'subject:/': 0.35; 'subject:lists': 0.36; 'convenient': 0.37; 'pull': 0.37; 'received:org': 0.38; 'goes': 0.39; 'to:addr:python.org': 0.40; 'touch': 0.70; 'subject:Making': 0.84; 'temporary.': 0.84
X-Injected-Via-Gmane http://gmane.org/
To python-list@python.org
From Terry Reedy <tjreedy@udel.edu>
Subject Re: Making the case for "typed" lists/iterators in python
Date Fri, 16 Dec 2011 17:21:14 -0500
References <mailman.3739.1324057724.27778.python-list@python.org> <roy-CE17C0.13053616122011@news.panix.com>
Mime-Version 1.0
Content-Type text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding 7bit
X-Gmane-NNTP-Posting-Host pool-74-109-121-73.phlapa.fios.verizon.net
User-Agent Mozilla/5.0 (Windows NT 6.1; WOW64; rv:8.0) Gecko/20111105 Thunderbird/8.0
In-Reply-To <roy-CE17C0.13053616122011@news.panix.com>
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.3755.1324074096.27778.python-list@python.org> (permalink)
Lines 23
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1324074096 news.xs4all.nl 6883 [2001:888:2000:d::a6]:55708
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:17390

Show key headers only | View raw


On 12/16/2011 1:05 PM, Roy Smith wrote:

> I'm working with now is functions that end in:
>
>     return [Foo(x) for x in bunch_of_x_thingies]
>
> When something goes amiss and I want to debug the problem, I often
> transform that into:
>
>      temp = [Foo(x) for x in bunch_of_x_thingies]
>      logger.debug(temp)
>      return temp
>
> It would be convenient to be able to get at and log the intermediate
> value without having to pull it out to an explicit temporary.

Decorate the function with @logreturn and you do not have to touch the 
function code. If the logging module does not now have such a decorator 
predefined (I simply do not know), perhaps it should.

-- 
Terry Jan Reedy

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


Thread

Making the case for "typed" lists/iterators in python Nathan Rice <nathan.alexander.rice@gmail.com> - 2011-12-16 12:48 -0500
  Re: Making the case for "typed" lists/iterators in python Roy Smith <roy@panix.com> - 2011-12-16 13:05 -0500
    Re: Making the case for "typed" lists/iterators in python Chris Angelico <rosuav@gmail.com> - 2011-12-17 05:25 +1100
    Re: Making the case for "typed" lists/iterators in python Arnaud Delobelle <arnodel@gmail.com> - 2011-12-16 18:38 +0000
    Re: Making the case for "typed" lists/iterators in python Chris Angelico <rosuav@gmail.com> - 2011-12-17 05:43 +1100
      Re: Making the case for "typed" lists/iterators in python Mel Wilson <mwilson@the-wire.com> - 2011-12-16 15:14 -0500
    Re: Making the case for "typed" lists/iterators in python Ben Finney <ben+python@benfinney.id.au> - 2011-12-17 07:17 +1100
    Re: Making the case for "typed" lists/iterators in python Terry Reedy <tjreedy@udel.edu> - 2011-12-16 17:21 -0500
  Re: Making the case for "typed" lists/iterators in python Ulrich Eckhardt <ulrich.eckhardt@dominolaser.com> - 2011-12-19 14:16 +0100
    Re: Making the case for "typed" lists/iterators in python Nathan Rice <nathan.alexander.rice@gmail.com> - 2011-12-19 10:56 -0500

csiph-web