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


Groups > comp.lang.python > #63518

Re: Recover handle to shadowed builtin?

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.freenet.ag!ecngs!feeder2.ecngs.de!novso.com!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!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.009
X-Spam-Evidence '*H*': 0.98; '*S*': 0.00; 'builtin': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'mode,': 0.16; 'nameerror:': 0.16; 'numpy': 0.16; 'pylab': 0.16; 'received:80.91.229.3': 0.16; 'received:dip0.t-ipconnect.de': 0.16; 'received:plane.gmane.org': 0.16; 'received:t-ipconnect.de': 0.16; 'roy': 0.16; 'wrote:': 0.18; '>>>': 0.22; 'import': 0.22; 'header:User-Agent:1': 0.23; 'defined': 0.27; 'header:X -Complaints-To:1': 0.27; "i'm": 0.30; '"",': 0.31; 'file': 0.32; '(most': 0.33; 'there': 0.35; 'doing': 0.36; 'subject:?': 0.36; 'to:addr:python-list': 0.38; 'recent': 0.39; 'does': 0.39; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'name': 0.63; 'sum': 0.64; 'more': 0.64; 'smith': 0.68; 'subject:handle': 0.84; 'recover': 0.91
X-Injected-Via-Gmane http://gmane.org/
To python-list@python.org
From Peter Otten <__peter__@web.de>
Subject Re: Recover handle to shadowed builtin?
Date Wed, 08 Jan 2014 21:24:37 +0100
Organization None
References <9D7A8CB8-A028-4DB0-A026-98BA4FF8124C@panix.com>
Mime-Version 1.0
Content-Type text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding 7Bit
X-Gmane-NNTP-Posting-Host p5084bf1b.dip0.t-ipconnect.de
User-Agent KNode/4.7.3
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://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 <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.5198.1389212641.18130.python-list@python.org> (permalink)
Lines 30
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1389212641 news.xs4all.nl 2959 [2001:888:2000:d::a6]:47016
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:63518

Show key headers only | View raw


Roy Smith wrote:

> I'm working with ipython's pylab mode, which replaces the builtin sum()
> with the one from numpy:
> 
> In [105]:
> sum
> 
> Out[105]:
> <function numpy.core.fromnumeric.sum>
> 
> Is there any way to recover a reference to the builtin sum()?

>>> from numpy import *
>>> sum
<function sum at 0x7fb99782cc08>
>>> del sum
>>> sum
<built-in function sum>

Doing it more than once does no harm:

>>> del sum
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'sum' is not defined
>>> sum
<built-in function sum>

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


Thread

Re: Recover handle to shadowed builtin? Peter Otten <__peter__@web.de> - 2014-01-08 21:24 +0100

csiph-web