Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #5279
| From | "Gabriel Genellina" <gagsl-py2@yahoo.com.ar> |
|---|---|
| Subject | Re: Peculiar Behaviour of __builtins__ |
| Date | 2011-05-12 23:02 -0300 |
| References | <BANLkTinHZzc=yry29jkZnCy=Z7E7Ue0vUQ@mail.gmail.com> <op.vvec5aa4x6zn5v@lepton.domain> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.1505.1305252309.9059.python-list@python.org> (permalink) |
En Thu, 12 May 2011 22:59:24 -0300, Gabriel Genellina <gagsl-py2@yahoo.com.ar> escribió: > En Thu, 12 May 2011 20:29:57 -0300, Aman Nijhawan > <amannijhawan@gmail.com> 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
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: Peculiar Behaviour of __builtins__ "Gabriel Genellina" <gagsl-py2@yahoo.com.ar> - 2011-05-12 23:02 -0300
csiph-web