__builtin__ quote

Chris Rebert clp at rebertia.com
Tue Jan 6 09:50:16 CET 2009


On Tue, Jan 6, 2009 at 12:47 AM, Steven Woody <narkewoody at gmail.com> wrote:
> On Tue, Jan 6, 2009 at 4:42 PM, James Stroud <jstroud at mbi.ucla.edu> wrote:
>> Steven Woody wrote:
>>>
>>> Hi,
>>>
>>> I am a new leaner and I get a question:  abs() is a member of
>>> __builtin__ module, but why should I use abs() rather than
>>> __builtin__.abs() ? Thanks.
>>
>> It saves typing.
>>
>> This might help your understanding:
>>
>> py> import __builtin__
>> py> __builtin__.abs is abs
>>    True
>>
>
> Does that mean someone did 'import * from __builtin__'  when python startup?

In a sense, yes. The interpreter effectively automatically does such an import.

Cheers,
Chris

-- 
Follow the path of the Iguana...
http://rebertia.com



More information about the Python-list mailing list