On Mon, Sep 25, 2017 at 10:03 AM, Stefan Ram <[email protected]> wrote:
> What's the difference between »builtins« and »_sitebuiltins«?
>
> |>>> type.__module__
> |'builtins'
> |
> |>>> help.__module__
> |'_sitebuiltins'
>
> I mean the semantic difference. Why are some entities placed
> into »builtins« and some into »_sitebuiltins«?
Because the 'help' function comes from site.py:
def sethelper():
builtins.help = _sitebuiltins._Helper()
If you're not importing site.py (eg "python3 -S"), you don't need the
code for help(), but you'll always have type().
Basically it's a memory-saving thing. Critical vs optional.
ChrisA
--
https://mail.python.org/mailman/listinfo/python-list