Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #17754
| Date | 2011-12-22 13:07 -0800 |
|---|---|
| From | Ethan Furman <ethan@stoneleaf.us> |
| Subject | Re: Can't I define a decorator in a separate file and import it? |
| References | <53a106b8-1a2f-4b9d-9cac-d6f7dab01696@q11g2000vbq.googlegroups.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.4001.1324589676.27778.python-list@python.org> (permalink) |
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~
Back to comp.lang.python | Previous | Next — Previous in thread | Find similar | Unroll thread
Can't I define a decorator in a separate file and import it? Saqib Ali <saqib.ali.75@gmail.com> - 2011-12-22 12:53 -0800
Re: Can't I define a decorator in a separate file and import it? Saqib Ali <saqib.ali.75@gmail.com> - 2011-12-22 13:09 -0800
Re: Can't I define a decorator in a separate file and import it? Ben Finney <ben+python@benfinney.id.au> - 2011-12-23 09:33 +1100
Re: Can't I define a decorator in a separate file and import it? Andrew Berg <bahamutzero8825@gmail.com> - 2011-12-22 15:20 -0600
Re: Can't I define a decorator in a separate file and import it? Ethan Furman <ethan@stoneleaf.us> - 2011-12-22 13:31 -0800
Re: Can't I define a decorator in a separate file and import it? Ethan Furman <ethan@stoneleaf.us> - 2011-12-22 13:07 -0800
csiph-web