[Tutor] __init__.py
Shidai Liu
shidai.liu at gmail.com
Mon May 23 02:46:46 CEST 2005
On 5/23/05, Joseph Quigley <cpu.crazy at gmail.com> wrote:
>
> I've seen many (python) "plugins" (some located in site-packages [windows
> here]) with the name __init__.py.
> What's their use?
> class foo:
> def __init__:
> print "this starts first"
> def foo1():
> print "this comes later. Init initializes the chain of functions in this
> class
>
> Now, i've never used a program (i can't seem to grasp all the self, and
> other things in OOP yet) with __init__ but I know what __init__ does in a
> class, not as a file name.
> I'm asking this out of curiosity, not for help.
> JQ
__init__.py will be executed when a package is imported.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20050523/bcd2ce64/attachment.html
More information about the Tutor
mailing list