Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: 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; 'bug': 0.02; 'skip': 0.04; 'unexpected': 0.07; '[1]:': 0.09; '[2]:': 0.09; '[3]:': 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:method': 0.09; 'underlying': 0.09; 'error:': 0.10; 'classes,': 0.13; 'tries': 0.15; '0))': 0.16; 'enigma': 0.16; 'kern': 0.16; 'old-style': 0.16; 'passed.': 0.16; 'subject:function': 0.16; 'subject:python.': 0.16; 'subject:release': 0.16; 'wrote:': 0.18; 'instance': 0.18; 'occurred': 0.18; 'input': 0.22; "doesn't": 0.22; 'header:In- Reply-To:1': 0.22; 'fine': 0.24; 'traceback': 0.24; 'tests': 0.25; 'code': 0.25; 'import': 0.27; 'invalid': 0.28; 'interpret': 0.29; 'problem': 0.29; 'error': 0.29; 'pm,': 0.29; 'subject:support': 0.30; 'returning': 0.32; 'header:User-Agent:1': 0.33; 'header:X -Complaints-To:1': 0.33; 'instead': 0.33; 'to:addr:python-list': 0.34; '(by': 0.37; 'checks': 0.37; 'class.': 0.37; 'but': 0.37; 'problems': 0.37; 'skip:_ 10': 0.37; 'using': 0.38; 'received:org': 0.38; 'first.': 0.39; 'should': 0.39; 'subject: (': 0.40; 'to:addr:python.org': 0.40; 'type': 0.61; 'order': 0.62; 'world': 0.62; 'love': 0.62; 'our': 0.64; 'believe': 0.65; 'here': 0.65; 'received:109': 0.78; 'corrupted': 0.84; 'nathan': 0.84; 'eco': 0.91 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Robert Kern Subject: Re: Elementwise -//- first release -//- Element-wise (vectorized) function, method and operator support for iterables in python. Date: Wed, 21 Dec 2011 16:29:33 +0000 References: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: host109-153-163-100.range109-153.btcentralplus.com User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:8.0) Gecko/20111105 Thunderbird/8.0 In-Reply-To: X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 34 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1324484994 news.xs4all.nl 6888 [2001:888:2000:d::a6]:36616 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:17672 On 12/21/11 3:15 PM, Nathan Rice wrote: >> Incidentally, displaying an ElementwiseProxy instance doesn't go down >> well with iPython: >> >> In [1]: from elementwise import * >> >> In [2]: e = ElementwiseProxy(['one','two','three']) >> >> In [3]: e >> Out[3]: ERROR: An unexpected error occurred while tokenizing input >> The following traceback may be corrupted or invalid >> The error message is: ('EOF in multi-line statement', (6, 0)) > > I love IPython, but it has had known problems with iterators for > years. A long time ago, I agonized over what I thought was a bug in > my code where itertools.count would skip numbers in IPython, but my > unit tests all passed. Everything should work fine if you tuple() it > first. This is a different problem, actually. The problem is that the recently added (by me, actually) pretty-printing system tries to dispatch based on the type. In order to handle old-style classes, it checks for the type using .__class__ first. ElementProxy's __getattribute__() gets in the way here by returning a generator instead of the ElementProxy class. -- Robert Kern "I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth." -- Umberto Eco