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


Groups > comp.lang.python > #80928 > unrolled thread

Re: How modules work in Python

Started byDennis Lee Bieber <wlfraed@ix.netcom.com>
First post2014-11-16 17:57 -0500
Last post2014-11-16 17:57 -0500
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

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

#80928 — Re: How modules work in Python

FromDennis Lee Bieber <wlfraed@ix.netcom.com>
Date2014-11-16 17:57 -0500
SubjectRe: How modules work in Python
Message-ID<mailman.15920.1416178639.18130.python-list@python.org>
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/

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web