473,326 Members | 2,168 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 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 1490
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: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.