Skip to content

Change template example to avoid wildcard import #170

@lsetiawan

Description

@lsetiawan

Thanks again for the awesome presentation today @drewoldag, this is a really neat template! One thing that I saw within the template is the use of a wildcard import with an example module as noted below. This is usually a really bad practice in Python as PEP8 states:

Wildcard imports (from import *) should be avoided, as they make it unclear which names are present in the namespace, confusing both readers and many automated tools. There is one defensible use case for a wildcard import, which is to republish an internal interface as part of a public API (for example, overwriting a pure Python implementation of an interface with the definitions from an optional accelerator module and exactly which definitions will be overwritten isn’t known in advance).

I think that it's would be better if the example could avoid this bad practice as it can potentially impact someone's learning of Python's best practice. Please let me know what you think, I can certainly make a PR on this. Thank you! 😄

{%- if create_example_module -%}
from .example_module import *
{% endif %}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions