472,968 Members | 1,488 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,968 software developers and data experts.

Python submodules and name imports

Hi,

First take a look at:

http://www.network-theory.co.uk/docs.../Packages.html

as I will use this module file layout as an example.

If I want to do the following:

from Sound import Effects
....
Effects.echo.echofilte(bla bla)

What will Sound/Effects/__init__.py need to contain then? I tried to define
the __all__ = ['echo','surround','reverse'] parameter in the init file, but
this only seems to be effective for " .. import *" statements.

Is the correct way of accomplishing this to explicitly import the submodules
in sound/Effects/__init__.py? I'm looking for the "official" way of doing
this.

Thank you,
Frank Aune
Aug 23 '07 #1
1 1480
On Aug 23, 2:58 pm, Frank Aune <Frank.A...@broadpark.nowrote:
Hi,

First take a look at:

http://www.network-theory.co.uk/docs.../Packages.html

as I will use this module file layout as an example.

If I want to do the following:

from Sound import Effects
...
Effects.echo.echofilte(bla bla)

What will Sound/Effects/__init__.py need to contain then? I tried to define
the __all__ = ['echo','surround','reverse'] parameter in the init file, but
this only seems to be effective for " .. import *" statements.

Is the correct way of accomplishing this to explicitly import the submodules
in sound/Effects/__init__.py? I'm looking for the "official" way of doing
this.

Thank you,
Frank Aune
You can put 'import echo' into sound/Effects/__init__.py. This is a
widespread practice. You could also put 'from echo import *' into the
file, if you wanted to have a single namespace for all methods in
Effects.

Aug 23 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

23
by: Yannick Patois | last post by:
Hi, Under some naming conditions of module files, it seems that python lost class static variables values. It seems only to append when importing a "badly" named module that itself import a...
2
by: danielmcbrearty | last post by:
Hi Old hand at perl, giving python a try. Trying to get pymedia running on my winxp box. Have installed activestate python 2.4 and pymedia using precompiled installers. Problem is it SEEMS...
9
by: TG | last post by:
hi. This is my first try on modules. I've got : tom/ __init__.py core.py ui.py
0
by: Kurt B. Kaiser | last post by:
Patch / Bug Summary ___________________ Patches : 408 open ( -9) / 3585 closed (+20) / 3993 total (+11) Bugs : 968 open ( +8) / 6505 closed ( +7) / 7473 total (+15) RFE : 267 open...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
3
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.