All stacks / Intents / Import star Also written as star import
Namespace Import JS · Modules syntax Copy
import * as name from "./module.js" ;example Copy
import * as validators from "./validators.js" ;
const email = "[email protected] " ;
console.log(validators.isEmail(email));
console.log(validators.isNotEmpty(email));Note Imports all named exports as a single object. The object is frozen (read-only). Useful when a module has many exports you want to use together.
__all__ (Controlling Exports) PY · Modules & Imports syntax Copy
__all__ = ['name1' , 'name2' ]example Copy
__all__ = ["format_price" , "validate_email" ]
def format_price(amount: float) -> str:
return f"${amount:,.2f}"
def validate_email(email: str) -> bool:
return "@" in email
def _internal_helper():
pass Note __all__ defines what 'from module import *' exports. It does not prevent direct imports of unlisted names. Prefix internal helpers with underscore by convention.
Related tasks