0

a.py

__all__=['b','c']
a='aaa'
b='bbb'
def c():
    print 'ccc'
def d():
    print 'dddd'

b.py

from a import a
print a
from a import *
print a
print d#error

Are there any other uses.

thanks

zjm1126
  • 63,397
  • 81
  • 173
  • 221

3 Answers3

3

Yes, it also changes what help(a) documents.

Alice Purcell
  • 12,622
  • 6
  • 51
  • 57
0

No, the purpose of __all__ is just to describe exactly what should be imported when you do from foo import *.

avpx
  • 1,892
  • 15
  • 13
0

No other uses, except limiting the damage caused by the horrible from ... import * usage.

Alex Martelli
  • 854,459
  • 170
  • 1,222
  • 1,395