Can't I define a decorator in a separate file and import it?
Ethan Furman
ethan at stoneleaf.us
Thu Dec 22 16:07:34 EST 2011
Saqib Ali wrote:
>
> I'm using this decorator to implement singleton class in python:
>
> http://stackoverflow.com/posts/7346105/revisions
>
> The strategy described above works if and only if the Singleton is
> declared and defined in the same file. If it is defined in a different
> file and I import that file, it doesn't work.
>
> Why can't I import this Singleton decorator from a different file?
> What's the best work around?
Post the code, and the traceback.
~Ethan~
More information about the Python-list
mailing list