Load three different modules which have the same name
Ben Finney
bignose+hates-spam at benfinney.id.au
Tue Mar 20 07:43:56 EDT 2007
"abcd" <codecraig at gmail.com> writes:
> nevermind this took care of it:
>
> import sys
>
> def tryAllThree():
> a = "c:\\alpha"
> b = "c:\\beta"
> g = "c:\\gamma"
>
> sys.path.append(a)
> import Person
> alpha = Person.Person()
To avoid this confusion, follow PEP 8
<URL:http://www.python.org/dev/peps/pep-0008/>; in particular, name
your classes with TitleCase and name your modules (i.e., name the
files that contain the code) with lowercase.
import person
alpha_person = person.Person()
As to the original question, you've already seen the answer:
from alpha import person
alpha_person = person.Person()
from beta import person
beta = person.Person()
from gamma import person
gamma_person = person.Person()
--
\ "If I ever get real rich, I hope I'm not real mean to poor |
`\ people, like I am now." -- Jack Handey |
_o__) |
Ben Finney
More information about the Python-list
mailing list