1. Anuncie Aqui ! Entre em contato fdantas@4each.com.br

[Python] Imports in Python - From vs. Full Path [duplicate]

Discussão em 'Python' iniciado por Stack, Novembro 5, 2024 às 13:22.

  1. Stack

    Stack Membro Participativo

    I am working on a python project that uses what we call "full path" import statements.

    For example:

    import path.to.my.module

    some_result = path.to.my.module.my_function()


    In previous projects, I have always used a "from" import statement.

    from path.to.my.module import my_function

    some_result = my_function()


    or, importing the entire module

    from path.to.my import module

    some_result = module.my_function()


    Is the "full path" import a standard python pattern? What are some of the reasons to/not to use the "full path" import pattern as opposed to the "from" import pattern?

    Continue reading...

Compartilhe esta Página