Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #45671
| Newsgroups | comp.lang.python |
|---|---|
| Date | 2013-05-21 08:26 -0700 |
| Message-ID | <02f0123d-2f9e-4287-b983-cfa1db9db69c@googlegroups.com> (permalink) |
| Subject | @staticmethods called more than once |
| From | Christian <mining.facts@gmail.com> |
Hi,
i'm somewhat confused working with @staticmethods. My logger and configuration methods are called n times, but I have only one call.
n is number of classes which import the loger and configuration class
in the subfolder mymodule. What might be my mistake mistake?
Many thanks
Christian
### __init__.py ###
from mymodule.MyLogger import MyLogger
from mymodule.MyConfig import MyConfig
##### my_test.py ##########
from mymodule import MyConfig,MyLogger
#Both methods are static
key,logfile,loglevel = MyConfig().get_config('Logging')
log = MyLogger.set_logger(key,logfile,loglevel)
log.critical(time.time())
#Output
2013-05-21 17:20:37,192 - my_test - 17 - CRITICAL - 1369149637.19
2013-05-21 17:20:37,192 - my_test - 17 - CRITICAL - 1369149637.19
2013-05-21 17:20:37,192 - my_test - 17 - CRITICAL - 1369149637.19
2013-05-21 17:20:37,192 - my_test - 17 - CRITICAL - 1369149637.19
Back to comp.lang.python | Previous | Next — Next in thread | Find similar | Unroll thread
@staticmethods called more than once Christian <mining.facts@gmail.com> - 2013-05-21 08:26 -0700
Re: @staticmethods called more than once Skip Montanaro <skip@pobox.com> - 2013-05-21 10:39 -0500
Re: @staticmethods called more than once John Gordon <gordon@panix.com> - 2013-05-21 16:34 +0000
Re: @staticmethods called more than once John Gordon <gordon@panix.com> - 2013-05-21 16:48 +0000
Re: @staticmethods called more than once Christian <mining.facts@gmail.com> - 2013-05-21 10:17 -0700
Re: @staticmethods called more than once Ethan Furman <ethan@stoneleaf.us> - 2013-05-21 09:30 -0700
Re: @staticmethods called more than once 88888 Dihedral <dihedral88888@googlemail.com> - 2013-05-21 18:23 -0700
csiph-web