Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #80928

Re: How modules work in Python

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 <python-python-list@m.gmane.org>
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 <wlfraed@ix.netcom.com>
Subject Re: How modules work in Python
Date Sun, 16 Nov 2014 17:57:02 -0500
Organization IISS Elusive Unicorn
References <CAA+hu4WstWquKEJ3C4AnWqbcNb5Y55G+xmywzF1hhEei9NQi=A@mail.gmail.com>
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 <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.15920.1416178639.18130.python-list@python.org> (permalink)
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

Show key headers only | View raw


On Sun, 16 Nov 2014 20:36:28 +0100, Abdul Abdul <abdul.sw84@gmail.com>
declaimed the following:

>
>My question is, where did PIL go here? Can a module have another module
>inside it?
>
	
	Define "module" <G>

	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/

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: How modules work in Python Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2014-11-16 17:57 -0500

csiph-web