faqts : Computers : Programming : Languages : Python : Language and Syntax

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

7 of 10 people (70%) answered Yes
Recently 5 of 7 people (71%) answered Yes

Entry

Are circular package references allowed in Python?

Aug 9th, 2000 02:22
unknown unknown, Alex Martelli


They're allowed.  E.g.:

D:\apy>python
Python 1.5.2 (#0, Apr 13 1999, 10:51:12) [MSC 32 bit (Intel)] on win32
Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
>>> import uno
>>> uno.fun()
Pak!
>>> import due
>>> due.fun()
Poook!
>>>

Where the packages are:

D:\apy>type uno.py
import due

pippo='Poook!'

def fun():
    print due.pippo

D:\apy>type due.py
import uno

pippo='Pak!'

def fun():
    print uno.pippo

D:\apy>