Google
 
Webnews.only-4-geeks.com
Interesting places
news.only-4-geeks.com Forum Index » Python

Smal question

 
Jump to:  
 
Hans Müller
PostPosted: Thu Jul 10, 2008 12:55 pm    Post subject: Smal question
       
Hello group,

I have some scripts sharing some common functions.
So what I'd like to have is a modern include.
Of course python does not have (with good reasons) no include statement.
But I'm too lazy to create a module which has to be installed into the interpreter for some functions I need to share in a project.
Is there any idea to do this ?

Thanks a lot

Hans
 

 
Nick Dumas
PostPosted: Thu Jul 10, 2008 1:04 pm    Post subject: Re: Smal question
       
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

This is easy. Simply create a .py file containing all the methods you
want to share. Put this file in the same directory as the rest of your
project files. In each of your project files that requires one of the
methods, simply "import <name of method file>". Python supports
impromptu module creation, which is great just for circumstances like this.

Hans Müller wrote:
Quote:
Hello group,

I have some scripts sharing some common functions.
So what I'd like to have is a modern include.
Of course python does not have (with good reasons) no include statement.
But I'm too lazy to create a module which has to be installed into the
interpreter for some functions I need to share in a project.
Is there any idea to do this ?

Thanks a lot

Hans
-----BEGIN PGP SIGNATURE-----

Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla - LINK

iEYEARECAAYFAkh2JOAACgkQLMI5fndAv9gZiACeP3puvMknR2HQTOXKaNeBtC+h
tyEAn3C6g9E5U5xXE4SQ7u368xdvkRx4
=J6Sv
-----END PGP SIGNATURE-----
 

 
Hans Müller
PostPosted: Thu Jul 10, 2008 1:32 pm    Post subject: Re: Smal question
       
Thanks a lot,

you made my day.

As often in python, it's really simple and useful !

Greetings

Hans
 

 
Bruno Desthuilliers
PostPosted: Thu Jul 10, 2008 2:45 pm    Post subject: Re: Smal question
       
Hans Müller a écrit :
Quote:
Hello group,

I have some scripts sharing some common functions.
So what I'd like to have is a modern include.
Of course python does not have (with good reasons) no include statement.
But I'm too lazy to create a module which has to be installed into the
interpreter for some functions I need to share in a project.

What do you mean "installed in the interpreter" ?
 

 
Terry Reedy
PostPosted: Thu Jul 10, 2008 4:34 pm    Post subject: Re: Smal question
       
Bruno Desthuilliers wrote:
Quote:
Hans Müller a écrit :
Hello group,

I have some scripts sharing some common functions.
So what I'd like to have is a modern include.
Of course python does not have (with good reasons) no include statement.
But I'm too lazy to create a module which has to be installed into the
interpreter for some functions I need to share in a project.

What do you mean "installed in the interpreter" ?

He probably meant either compiled into the interpreter or installed in
the interpreter directory, not knowing that one can import from the
project directory, and that the project directory gets added to the
front of sys.path (as '.').
 

 
Aahz
PostPosted: Thu Jul 10, 2008 8:31 pm    Post subject: Re: Smal question
       
[contextectomy]

If we answer a small question, are we making smalltalk?
--
Aahz (aahz@pythoncraft.com) <*> LINK

"as long as we like the same operating system, things are cool." --piranha
 

Page 1 of 1 .:.

Google
 
Webnews.only-4-geeks.com

Windows Update | C++ | C | PHP | JavaScript | Photoshop | Programming | Windows 2000 | Python | Windows XP | Object | Flash | Flash - ActionScript | Paint Shop Pro | Excel | PowerPoint | Access | Word | Windows 98 | Internet Explorer 6.0 | CorelDraw12 | Java | XML | asm x86 | Linux Mandrake | Linux RedHat | Outlook |  | news from newsgroups |_ | s

Web Templates

Awesome Website Templates ©

proces pobierania linkow wymiana linkami trwa pobierania linkow pobieranie linkow wymiana linkow