as we've seena python module exports all the names assigned at the top level of its file there is no notion of declaring which names should and shouldn' be visible outside the module in factthere' no way to prevent client from changing names inside module if it wants to in pythondata hiding in modules is conventionnot syntactical constraint if you want to break module by trashing its namesyou canbut fortunatelyi've yet to meet programmer for whom this was life goal some purists object to this liberal attitude toward data hidingclaiming that it means python can' implement encapsulation howeverencapsulation in python is more about packaging than about restricting we'll expand this idea in the next part in relation to classeswhich also have no privacy syntax but can often emulate its effect in code minimizing from damage_x and __all__ as special caseyou can prefix names with single underscore ( _xto prevent them from being copied out when client imports module' names with from statement this really is intended only to minimize namespace pollutionbecause from copies out all namesthe importer may get more than it' bargained for (including names that overwrite names in the importerunderscores aren' "privatedeclarationsyou can still see and change such names with other import formssuch as the import statementunders py a_bc_d from unders import ac ( _b nameerrorname '_bis not defined load non _x names only import unders unders _b but other importers get every name alternativelyyou can achieve hiding effect similar to the _x naming convention by assigning list of variable name strings to the variable __all__ at the top level of the module when this feature is usedthe from statement will copy out only those names listed in the __all__ list in effectthis is the converse of the _x convention__all__ identifies names to be copiedwhile _x identifies names not to be copied python looks for an __all__ list in the module first and copies its names irrespective of any underscoresif __all__ is not definedfrom copies all names without single leading underscorealls py __all__ [' ''_c'__all__ has precedence over _x data hiding in modules