On Thu, Jun 13, 2013 at 11:08 AM, Steven D'Aprano
<steve+comp.lang.pyt...@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
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to