Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!us.feeder.erje.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'subject:Python': 0.06; '"who': 0.09; 'here?': 0.09; 'pil': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'subject:modules': 0.09; 'subject:How': 0.10; 'def': 0.12; '"module"': 0.16; 'message-id:@4ax.com': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'module': 0.19; 'example': 0.22; 'import': 0.22; 'print': 0.22; 'url:home': 0.24; 'question': 0.24; 'define': 0.26; 'pass': 0.26; 'defined': 0.27; 'header:X-Complaints-To:1': 0.27; '+0100,': 0.31; 'file': 0.32; 'class': 0.32; 'another': 0.32; 'open': 0.33; 'could': 0.34; 'something': 0.35; 'objects': 0.35; 'but': 0.35; 'charset:us-ascii': 0.36; 'level': 0.37; 'nov': 0.38; 'whatever': 0.38; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'name': 0.63; 'within': 0.65; 'odds': 0.84; 'received:108': 0.93 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Dennis Lee Bieber Subject: Re: How modules work in Python Date: Sun, 16 Nov 2014 17:57:02 -0500 Organization: IISS Elusive Unicorn References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: adsl-108-79-216-34.dsl.klmzmi.sbcglobal.net X-Newsreader: Forte Agent 6.00/32.1186 X-No-Archive: YES X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 47 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1416178639 news.xs4all.nl 2847 [2001:888:2000:d::a6]:44445 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:80928 On Sun, 16 Nov 2014 20:36:28 +0100, Abdul Abdul declaimed the following: > >My question is, where did PIL go here? Can a module have another module >inside it? > Define "module" from X import Y makes the name of whatever Y is in X available directly at the level of the import... -=-=-=- file example.py import XYZ as Something aCONSTANT = "who cares" def aFunction(): pass class aClass(object): pass -=-=-=-=-=- import example print example.aCONSTANT print example.Something.unknown print example.aFunction() anObject = example.aClass() anObject.undefined() -=-=-=- from example import Something from example import aClass The odds are that PIL.Image is a class defined in PIL, and objects of the class have an open method... But it could also be a submodule/package within PIL that is imported... -- Wulfraed Dennis Lee Bieber AF6VN wlfraed@ix.netcom.com HTTP://wlfraed.home.netcom.com/