Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!feed.xsnews.nl!border-1.ams.xsnews.nl!xlned.com!feeder7.xlned.com!news2.euro.net!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.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'bug': 0.02; 'skip': 0.04; 'unexpected': 0.07; '21,': 0.09; '[1]:': 0.09; '[2]:': 0.09; '[3]:': 0.09; 'subject:method': 0.09; 'error:': 0.10; 'am,': 0.12; 'classes,': 0.13; 'tries': 0.15; '0))': 0.16; 'anyhow,': 0.16; 'kern': 0.16; 'old-style': 0.16; 'passed.': 0.16; 'subject:function': 0.16; 'subject:python.': 0.16; 'subject:release': 0.16; 'wed,': 0.17; 'wrote:': 0.18; '>>>': 0.18; 'instance': 0.18; 'occurred': 0.18; 'input': 0.22; 'dec': 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; 'message-id:@mail.gmail.com': 0.28; "skip:' 10": 0.29; 'problem': 0.29; 'error': 0.29; 'pm,': 0.29; 'subject:support': 0.30; 'thanks': 0.31; 'returning': 0.32; 'instead': 0.33; 'received:209.85.160': 0.33; 'to:addr:python- list': 0.34; 'probably': 0.34; 'received:209.85.160.46': 0.35; 'received:mail-pw0-f46.google.com': 0.35; '(by': 0.37; 'awesome': 0.37; 'checks': 0.37; 'class.': 0.37; 'to:name:python-list': 0.37; 'but': 0.37; 'corner': 0.37; 'received:google.com': 0.37; 'problems': 0.37; 'skip:_ 10': 0.37; 'doing': 0.38; 'using': 0.38; 'received:209.85': 0.38; 'first.': 0.39; 'should': 0.39; 'subject: (': 0.40; 'received:209': 0.40; 'to:addr:python.org': 0.40; 'type': 0.61; '2011': 0.61; 'order': 0.62; 'love': 0.62; 'here': 0.65; '11:29': 0.84; 'corrupted': 0.84; 'nathan': 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; bh=cP0kz/8LVvnqD9cyZ1JccIzL38OJD+9waWUIPGZAqVE=; b=vRkEEuzCYHn7i0at/Uj7/lI/hIEDqlJWvbYCL+ZUk7EnFVX6kL++Eol9RLaXDDZoOJ J2tWYYXSeUCKM+RvlVCW8s/KhUVlOhbQVlNZXnypAaaynuZJOJGGC7Tejvkzf40u1DPx BiOb3T3YHLf+rLe/QpKGYpzzVGhG/ZkmCkNhs= MIME-Version: 1.0 In-Reply-To: References: Date: Wed, 21 Dec 2011 11:43:49 -0500 Subject: Re: Elementwise -//- first release -//- Element-wise (vectorized) function, method and operator support for iterables in python. From: Nathan Rice To: python-list Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable 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: 37 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1324485833 news.xs4all.nl 6954 [2001:888:2000:d::a6]:42461 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:17673 On Wed, Dec 21, 2011 at 11:29 AM, Robert Kern wrote= : > 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 =3D 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. =A0A 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. =A0Everything 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 us= ing > .__class__ first. ElementProxy's __getattribute__() gets in the way here = by > returning a generator instead of the ElementProxy class. Thanks for the heads up Robert. Given that IPython is awesome and people should probably be doing an '.apply(type)' in that instance anyhow, I will corner case that on __getattribute__. Nathan