[Python] When is a function in a standard library module called a built-in function?

Discussão em 'Python' iniciado por Stack, Fevereiro 7, 2025.

  1. Stack

    Stack Membro Participativo

    I am confused about the term "built-in" function. I thought it meant only those functions built into the interpreter and documented in - 2. Built-in Functions
    But it appears that functions defined in standard library modules are also built-in functions (in some cases). For example -

    >>> import os
    >>> os.chdir
    <built-in function chdir>
    >>> import warnings
    >>> warnings.warn
    <built-in function warn>
    >>> import json
    >>> json.dumps
    <function dumps at 0x7f3643a240d0> # not built-in
    >>> dir
    <built-in function dir>
    >>>


    So when is a function in a standard library module called a built-in function and when is it not?

    Continue reading...

Compartilhe esta Página