|
 |
Python Language...
Power of the Snake .. .. |
|
|
|
 | Python > What is `__all__` in Python |  |
Python's got this neat little trick up its sleeve called __all__ . Basically, it's like having a VIP list at a party. You slap it on a module, and it tells Python, "Hey, only these folks are allowed to strut their stuff when someone does a fancy import * from this module." So, if you've got a messy module with more junk than a Deadpool costume closet, but you only want to show off your A-listers, like 'a' and 'b', you toss them into __all__ and bam! Python knows the deal. No more accidental imports cluttering up your code like a bad guy convention. It's like having a bouncer at the door of your Python party, but way less intimidating and with fewer broken bones.
Case 1: No __all__
|
|