X-FeedAbuse: http://nntpfeed.proxad.net/abuse.pl feeded by 88.191.16.109 Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.dougwise.org!nntpfeed.proxad.net!nospam.fr.eu.org!usenet-fr.net!proxad.net!feeder1-2.proxad.net!news.wiretrip.org!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!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.007 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'python': 0.07; '3.x': 0.09; 'attribute': 0.09; 'builtin': 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; "'s')": 0.16; '(note': 0.16; '__builtins__': 0.16; 'from:addr:yahoo.com.ar': 0.16; 'thu,': 0.22; 'trying': 0.23; 'module,': 0.23; 'function': 0.27; 'error': 0.29; 'detail.': 0.31; 'imported': 0.31; 'called': 0.32; 'to:addr :python-list': 0.32; 'another': 0.32; 'module': 0.33; 'using': 0.34; 'header:X-Complaints-To:1': 0.34; 'header:User-Agent:1': 0.35; 'fails': 0.35; 'however': 0.37; 'should': 0.37; 'received:org': 0.38; 'to:addr:python.org': 0.39; 'header:Mime- Version:1': 0.39; 'add': 0.39; 'works': 0.40; 'header:Received:5': 0.40; '2011': 0.62; 'received:190': 0.69; '-0300,': 0.84; 'genellina': 0.84; 'min': 0.84; 'gabriel': 0.91 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: "Gabriel Genellina" Subject: Re: Peculiar Behaviour of __builtins__ Date: Thu, 12 May 2011 23:02:02 -0300 References: Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1; format=flowed; delsp=yes Content-Transfer-Encoding: 8bit X-Gmane-NNTP-Posting-Host: 190.2.4.25 User-Agent: Opera Mail/11.10 (Win32) 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: 25 NNTP-Posting-Host: 82.94.164.166 X-Trace: 1305252309 news.xs4all.nl 41103 [::ffff:82.94.164.166]:51578 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:5279 En Thu, 12 May 2011 22:59:24 -0300, Gabriel Genellina escribió: > En Thu, 12 May 2011 20:29:57 -0300, Aman Nijhawan > escribió: > >> I was trying to call the builtin function min by using >> getattr(__builtins__,'min') >> >> This works at the interpretter prompt >> >> However when I called it inside a module that was imported by another >> module >> it fails and gives an attribute error > > __builtins__ (note the final 's') is an implementation detail. You want > the __builtin__ (no 's') module, renamed 'builtin' in Python 3.x Should read "...renamed 'builtins' in Python 3.x, just to add to the confusion." :) -- Gabriel Genellina