I have the following code:
A.py
from B import B
class R:
def __str__(self):
return "hello world"
b = B()
print b
B.py
from A import R
class B:
def __init__(self):
self.r = R()
def __str__(self):
return self
Thanks,
I had not found anything about it. But I had not search correctly.
There is an entry in the FAQ about it:
http://www.python.org/doc/faq/programming.html#how-can-i-have-modules-that-mutually-import-each-other
I like the most the third way.
I have also tried to move the import to the __init
Hi,
I am parsing html documents using the html parser from libxml2, and if
the encoding is included in the document it works perfectly but if it
is not, I think it does not work well (probably because I am doing
something wrong).
As it is said in http://xmlsoft.org/encoding.html the parser should