473,508 Members | 4,712 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Hide module function definitions

Hello all,

I know this must be a newbie question, but I haven't found the solution in
the tutorials I have read.

For a dSPACE/Controldesk application I am defining several of my own
modules.
In those modules I also have function definitions of functions I only use in
that module.
Is it possible to hide these functions when somebody would use "import
mymodule"?

Thanks in advance!

- Raymond

P.S.: Any links to usefull documentation regarding Python (or Python for
dSPACE in specific) would also be greatly appreciated!
Jul 18 '05 #1
2 7922

There are two options:

1) Explicitly list the functions, classes, etc. to be exported by the
module in a list called __all__ inside the module.

2) Start the names of functions, classes, etc. private to the module
with an underscore character.

/Jean Brouwers
ProphICy Semiconductor, Inc.
In article <ca**********@voyager.news.surf.net>, Raymond Tinsel
<ti****@wt.tno.nl> wrote:
Hello all,

I know this must be a newbie question, but I haven't found the solution in
the tutorials I have read.

For a dSPACE/Controldesk application I am defining several of my own
modules.
In those modules I also have function definitions of functions I only use in
that module.
Is it possible to hide these functions when somebody would use "import
mymodule"?

Thanks in advance!

- Raymond

P.S.: Any links to usefull documentation regarding Python (or Python for
dSPACE in specific) would also be greatly appreciated!

Jul 18 '05 #2
"Raymond Tinsel" <ti****@wt.tno.nl> wrote in message news:<ca**********@voyager.news.surf.net>...
In those modules I also have function definitions of functions I only use in
that module.
Is it possible to hide these functions when somebody would use "import
mymodule"?


If you start the function name with an underscore, python won't import
it. Also, you can define the special variable __all__.

See http://docs.python.org/ref/import.html.
Jul 18 '05 #3

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

Similar topics

16
10062
by: Jeff Wagner | last post by:
Is there a Python module or method that can convert between numeric bases? Specifically, I need to convert between Hex, Decimal and Binary such as 5Ah = 90d = 01011010b. I searched many places...
17
57362
by: gokul | last post by:
Hi, Iam a newbie to dotnet and I experience problems in using the Browser control in VB .net. Though Iam able to use it with its basic features, I need to customise it. ...
13
73970
by: genetic.error | last post by:
I'm moving from Vb6 to VB.Net. I have a feeling this has come up before... The VS.Net MSDN file seems to state that the following should work: Form1.Show Form1.Visible = True Form1.Hide...
13
14686
by: DS | last post by:
How do you hide the Title Bar for Access the application. I have everything done but I need to hide the title bar. I've seen code to hide Access but that seems like overkill. Can I put hiding...
1
10181
by: lauren quantrell | last post by:
Before getting pistol whipped, I know this is a well-worn topic but I don't see the answer... I know how to hide the Access window, I know how to disable the Access application's close button, but...
8
3705
by: MakaMaka | last post by:
Hi, I have a scope related question that I haven't been able to find an answer to anywhere. Is there a way to have a function in an imported module add variables to the scope of the calling...
7
2779
by: Chris Jones | last post by:
I'm trying to make sense of a python program and was wondering if vim has any python-oriented functionalities (apart from syntax highlighting) that would make it somewhat easier to browse the...
11
2554
by: Nadeem | last post by:
Hello all, I'm trying to write a function that will dynamically generate other functions via exec. I then want to be able to import the file (module) containing this function and use it in other...
13
2265
by: Rafe | last post by:
Hi, I am in a situation where I feel I am being forced to abandon a clean module structure in favor of a large single module. If anyone can save my sanity here I would be forever grateful. My...
0
7228
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7128
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7332
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
7058
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
1
5057
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...
0
4715
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3191
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1565
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
769
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.