Creating classes and objects more than once?
Arnaud Delobelle
arnodel at googlemail.com
Thu Nov 27 15:05:01 EST 2008
Viktor Kerkez <alefnula at gmail.com> writes:
> Here is the situation:
>
> $ ls
> test
> $ cd test
> $ ls
> __init__.py data.py
> $ cat __init__.py
>
> $ cat data.py
> DATA = {}
>
> $ cd ..
> $ python
>>>> import os
>>>> from test.data import DATA
>>>> DATA['something'] = 33
>>>> os.chdir('test')
>>>> from data import DATA as NEW_DATA
>>>> DATA
> {'something': 33}
>>>> NEW_DATA
> {}
>
>
> Is this a bug?
No. It's one of the compelling features of Python modules.
--
Arnaud
More information about the Python-list
mailing list