module Cyclic references

Karthik Gurumurthy karthikg at aztec.soft.net
Sun Jan 6 13:42:39 EST 2002


hi all,
my code is behaving in a strange way.

I have 4 modules

test.py -- > from movie import Movie, Rental 
movie.py --> has 2 classes Movie , Rental 
		#needs price and hence does 
		import price
price.py --> needs Movie 
		#does
		from movie import Movie, Rental
cust.py  --> has one class Customer

so this is the sequence.

test-->loads movie --> load price which in turn needs movie.

Can someone tell me what's wrong here??

>>> import test
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "test.py", line 1, in ?
    from movie import Movie, Rental
  File "movie.py", line 1, in ?
    import price
  File "price.py", line 1, in ?
    from movie import Movie, Rental
ImportError: cannot import name Movie
>>>


This sequence works just fine!
>>> import price
>>> import movie
>>> import cust
>>> import test

thanks 
karthik.

-----Original Message-----
From: python-list-admin at python.org
[mailto:python-list-admin at python.org]On Behalf Of marco
Sent: Saturday, December 22, 2001 5:48 AM
To: python-list at python.org
Subject: Re: vi or emacs for editing Python on Linux?


"maxm" <maxm at mxm.dk> writes:

> One of my biggest problems in switching is my editor. On windows I use
> Ultraedit as a general editor, and i type really fast in it. Knowing the
> shortcuts and all. Every time I boot up one of my Linux machines I have a
> hard time editing files under the arcane unix editors. I have tried both
> emacs and vim and I disklike both!

Maybe Nedit is good for Windows people: www.nedit.org
(but I use emacs myself -- those "arcane" editors are
tried and true).

--
mdlch at altavista.net
Gunnm: Broken Angel
http://reimeika.ca/
-- 
http://mail.python.org/mailman/listinfo/python-list




More information about the Python-list mailing list