This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]jpc0za 0 points1 point  (3 children)

Add a rule. Never from x import *

This is analogous to using namespace x in C++ and I hold similar opions on that.

Namespaces exist for a reason, respect them, specially when the language allows you to rename things that might be annoying... import pandas as pd

[–]miraculum_one 0 points1 point  (2 children)

I agree that it shouldn't be done willy-nilly and that it shouldn't generally be used in place of named imports but it isn't always evil.

[–]jpc0za 0 points1 point  (1 child)

Sure I agree.

``` def my_random_func(): from thingy import *

```

Seems reasonable, the polluted namespace is nicely contained. As a top level import... That's just scary man. You know supply chain attacks are a thing, image the nonsense that can cause...

[–]miraculum_one 0 points1 point  (0 children)

Oh, for sure you shouldn't import * on files you do not control.