Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #80928
| From | Dennis Lee Bieber <wlfraed@ix.netcom.com> |
|---|---|
| Subject | Re: How modules work in Python |
| Date | 2014-11-16 17:57 -0500 |
| Organization | IISS Elusive Unicorn |
| References | <CAA+hu4WstWquKEJ3C4AnWqbcNb5Y55G+xmywzF1hhEei9NQi=A@mail.gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.15920.1416178639.18130.python-list@python.org> (permalink) |
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
Re: How modules work in Python Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2014-11-16 17:57 -0500
csiph-web