__init__.py

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Tina I

    #1

    __init__.py

    When looking at other peoples code (to learn from it) I keep seeing an
    empty file named "__init__.p y". What's the purpose of this?

    Thanks
    Tina
  • Tina I

    #2
    Re: __init__.py

    Tina I wrote:
    When looking at other peoples code (to learn from it) I keep seeing an
    empty file named "__init__.p y". What's the purpose of this?
    >
    Thanks
    Tina
    Duh! Never mind... found it.
    Kinda neat actually :)

    T

    Comment

    • Jorgen Grahn

      #3
      Re: __init__.py

      On Mon, 26 Mar 2007 08:27:19 +0200, Tina I <tinaweb@bestem selv.comwrote:
      Tina I wrote:
      >When looking at other peoples code (to learn from it) I keep seeing an
      >empty file named "__init__.p y". What's the purpose of this?
      >>
      >Thanks
      >Tina
      >
      Duh! Never mind... found it.
      Kinda neat actually :)
      /What/ was neat? It's polite in cases like this to explain what the
      answer or solution was.

      I have never seen an empty __init__.py, and I'd like to know what its
      purpose could be.

      BR,
      /Jorgen

      --
      // Jorgen Grahn <grahn@ Ph'nglui mglw'nafh Cthulhu
      \X/ snipabacken.dyn dns.org R'lyeh wgah'nagl fhtagn!

      Comment

      • Steve Holden

        #4
        Re: __init__.py

        Jorgen Grahn wrote:
        On Mon, 26 Mar 2007 08:27:19 +0200, Tina I <tinaweb@bestem selv.comwrote:
        >Tina I wrote:
        >>When looking at other peoples code (to learn from it) I keep seeing an
        >>empty file named "__init__.p y". What's the purpose of this?
        >>>
        >>Thanks
        >>Tina
        >Duh! Never mind... found it.
        >Kinda neat actually :)
        >
        /What/ was neat? It's polite in cases like this to explain what the
        answer or solution was.
        >
        I have never seen an empty __init__.py, and I'd like to know what its
        purpose could be.
        >
        BR,
        /Jorgen
        >
        The presence of an __init__.py marks a directory as the root of a Python
        package, which means other modules can be found in it. This allows you
        to import names with multiple levels of dots, which are modules within
        packages.

        regards
        Steve
        --
        Steve Holden +44 150 684 7255 +1 800 494 3119
        Holden Web LLC/Ltd http://www.holdenweb.com
        Skype: holdenweb http://del.icio.us/steve.holden
        Recent Ramblings http://holdenweb.blogspot.com

        Comment

        • Tina I

          #5
          Re: __init__.py

          Jorgen Grahn wrote:
          On Mon, 26 Mar 2007 08:27:19 +0200, Tina I <tinaweb@bestem selv.comwrote:
          >Tina I wrote:
          >>When looking at other peoples code (to learn from it) I keep seeing an
          >>empty file named "__init__.p y". What's the purpose of this?
          >>>
          >>Thanks
          >>Tina
          >Duh! Never mind... found it.
          >Kinda neat actually :)
          >
          /What/ was neat? It's polite in cases like this to explain what the
          answer or solution was.
          >
          I have never seen an empty __init__.py, and I'd like to know what its
          purpose could be.
          >
          BR,
          /Jorgen
          >
          Sorry, it was just that it was so easy to find right there in the
          documentation. I had just missed it the first time around. So I kinda
          assumed that since it was spelled out so well in the doc I was asking a
          very stupid question.
          But anyway, it can be found here:


          Tina

          Comment

          Working...