Re: question about importing a package

2012-12-06 Thread Terry Reedy
On 12/6/2012 11:50 AM, Matt wrote: It works now. Steven and Alex, thanks for your help! I ended up leaving sample.py and foo.py and bar.p the way they were, and in __init__.py putting: from foo import * from bar import * So my mistake was not importing the foo and bar modules into sub_one/__

Re: question about importing a package

2012-12-06 Thread Matt
It works now. Steven and Alex, thanks for your help! I ended up leaving sample.py and foo.py and bar.p the way they were, and in __init__.py putting: from foo import * from bar import * So my mistake was not importing the foo and bar modules into sub_one/__init__.py. I also see how the __all_

Re: question about importing a package

2012-12-05 Thread Steven D'Aprano
On Wed, 05 Dec 2012 20:58:46 -0800, Matt wrote: > I have a directory structure that looks like this: > > sample.py > sub_one/ > __init__.py # defines only the list __all__ = ['foo', 'bar'] > foo.py # defines the function in_foo() > bar.py # defines the function in_bar()

Re: question about importing a package

2012-12-05 Thread alex23
On 6 Dec, 14:58, Matt wrote: > I have a directory structure that looks like this: > > sample.py > sub_one/ >       __init__.py     # defines only the list    __all__ = ['foo', 'bar'] >       foo.py           # defines the function in_foo() >       bar.py           # defines the function in_bar() >

Re: question about importing a package

2012-12-05 Thread Chris Angelico
On Thu, Dec 6, 2012 at 3:58 PM, Matt wrote: > I have about 30 modules in my package (foos and bars) and I don't want 30 > lines at the top of each file that uses this package. What am I doing wrong? Not necessarily wrong, but definitely something to query: WHY do you have thirty modules in your