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


Groups > comp.lang.python > #47882

Re: "Don't rebind built-in names*" - it confuses readers

References (1 earlier) <dffd70ad-4e9a-45cd-914b-7f1388ded5a2@a9g2000pbq.googlegroups.com> <51b69332$0$29997$c3e8da3$5496439d@news.astraweb.com> <CAMjeLr9pURVnRmsFFuOt5vxGvDMmmyTzmR49-k5ourng98VsiQ@mail.gmail.com> <mailman.3145.1371082102.3114.python-list@python.org> <51b91b89$0$29997$c3e8da3$5496439d@news.astraweb.com>
Date 2013-06-13 11:30 +1000
Subject Re: "Don't rebind built-in names*" - it confuses readers
From Chris Angelico <rosuav@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.3151.1371087004.3114.python-list@python.org> (permalink)

Show all headers | View raw


On Thu, Jun 13, 2013 at 11:08 AM, Steven D'Aprano
<steve+comp.lang.python@pearwood.info> wrote:
> On Thu, 13 Jun 2013 10:08:14 +1000, Chris Angelico wrote:
>
>>>>> int="five"
>>>>> [__builtins__.int(i) for i in ["1","2","3"]]
>
> Don't use __builtins__, it's an implementation detail.
>
> In Python 2.x, there is __builtins__ with an "s" in the global namespace
> if you are running CPython, but not necessarily other implementations.
> There is __builtin__ with no "s" which is defined by the language, but
> you have to import it first.
>
> In Python 3.x, you just import builtins with an "s" and no underscores,
> no matter what implementation you use.

Oh, sorry, my bad. I tend to just whip something up in IDLE and see if
it works, rather than actually check the spec. Listen to Steven, he
knows what he's about!

ChrisA

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


Thread

"Don't rebind built-in names*" - it confuses readers Terry Jan Reedy <tjreedy@udel.edu> - 2013-06-10 20:14 -0400
  Re: "Don't rebind built-in names*" - it confuses readers rusi <rustompmody@gmail.com> - 2013-06-10 19:36 -0700
    Re: "Don't rebind built-in names*" - it confuses readers Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-06-11 03:02 +0000
      Re: "Don't rebind built-in names*" - it confuses readers rusi <rustompmody@gmail.com> - 2013-06-10 20:30 -0700
        Re: "Don't rebind built-in names*" - it confuses readers Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-06-11 05:52 +0000
        Re: "Don't rebind built-in names*" - it confuses readers Chris Angelico <rosuav@gmail.com> - 2013-06-11 17:20 +1000
      Re: "Don't rebind built-in names*" - it confuses readers Chris Angelico <rosuav@gmail.com> - 2013-06-11 13:57 +1000
      Re: "Don't rebind built-in names*" - it confuses readers Serhiy Storchaka <storchaka@gmail.com> - 2013-06-11 18:55 +0300
      Re: "Don't rebind built-in names*" - it confuses readers Mark Janssen <dreamingforward@gmail.com> - 2013-06-12 17:04 -0700
        Re: "Don't rebind built-in names*" - it confuses readers Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-06-13 01:01 +0000
      Re: "Don't rebind built-in names*" - it confuses readers Chris Angelico <rosuav@gmail.com> - 2013-06-13 10:08 +1000
        Re: "Don't rebind built-in names*" - it confuses readers Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-06-13 01:08 +0000
          Re: "Don't rebind built-in names*" - it confuses readers Chris Angelico <rosuav@gmail.com> - 2013-06-13 11:30 +1000
      Re: "Don't rebind built-in names*" - it confuses readers Skip Montanaro <skip@pobox.com> - 2013-06-12 19:18 -0500
      Re: "Don't rebind built-in names*" - it confuses readers Chris Angelico <rosuav@gmail.com> - 2013-06-13 10:33 +1000
      Re: "Don't rebind built-in names*" - it confuses readers Ethan Furman <ethan@stoneleaf.us> - 2013-06-12 17:30 -0700
  Re: "Don't rebind built-in names*" - it confuses readers Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-06-11 02:56 +0000
    Re: "Don't rebind built-in names*" - it confuses readers Terry Jan Reedy <tjreedy@udel.edu> - 2013-06-11 02:06 -0400
    Re: "Don't rebind built-in names*" - it confuses readers Rick Johnson <rantingrickjohnson@gmail.com> - 2013-06-11 08:22 -0700
      Re: "Don't rebind built-in names*" - it confuses readers Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-06-11 16:59 +0000
      Re: "Don't rebind built-in names*" - it confuses readers Chris Angelico <rosuav@gmail.com> - 2013-06-12 03:32 +1000

csiph-web