D A Vincent
D A Vincent

Reputation: 364

Python: What is a 'from import * safe' module?

I'm looking at "Idioms and Anti-Idioms in Python" in the part where it talks about the situation when a module "advertises itself as from import * safe".

What are examples of modules that are safe in this sense? I think this sense is different from a module being simply 'import safe' (no from, no star).

Why would one want a module to be safe in this sense?

Upvotes: 2

Views: 434

Answers (1)

AI Generated Response
AI Generated Response

Reputation: 8835

It means that it does not use names that are commonly used by other modules including the __builtin__ module. For example, a module would not be safe if it had "def ord(x)" or "def int(x)" because those are python builtins.

Upvotes: 1

Related Questions