In article <42062deb-785a-4955-9ce0-d9fb7a264...@j27g2000yqn.googlegroups.com>,
Vinay Sajip wrote:
>
>I'm reviewing the documentation at the moment, as it happens, and it
>still seems hard to be able to put together a structure which is good
>for everyone. A full treatment, it seems to me, would
In article ,
Pete Emerson wrote:
>
>Excellent, this is what I finally discovered, although I was looking
>for 'foo' in sys.modules.keys(), which apparently isn't necessary.
Actually, `foo in sys.modules.keys()` is double-slow, because first the
dict must be scanned to create a list, and then the
On Mar 6, 11:13 pm, Pete Emerson wrote:
>
> 1) In debug mode, send what would have gone to syslog to STDOUT or
> STDERR
> 2) In non-debug mode, use /dev/log or localhost:514 depending on what
> is set
> 3) Allow for multiple levels ofloggingbeyond INFO, WARNING, CRIT ...
> essentially allow multip
On Mar 7, 12:34 pm, Steve Holden wrote:
> My own impression of theloggingmodule, formed from trying to use its
> documentation in the past, is that it's somewhat unapproachable, and
> difficult to use for simple purposes.
>
> I am happy to say that now I see the current (3.1) documentation it has
Pete Emerson wrote:
On Mar 5, 1:14 pm, Chris Rebert wrote:
On Fri, Mar 5, 2010 at 12:25 PM, Pete Emerson wrote:
On Fri, Mar 5, 2010 at 12:17 PM, Chris Rebert wrote:
On 3/5/10, Pete Emerson wrote:
In a module, how do I create a conditional that will do something
bas
Vinay Sajip wrote:
[...]
> Well, the logging package is available in Python and ready for use and
> pretty much battle tested, so why not use that? Are you planning to
> use third-party libraries in your Python work, or write everything
> yourself? If you are planning to use third party libraries,
On Mar 6, 2:38 pm, Vinay Sajip wrote:
> On Mar 5, 9:29 pm, Pete Emerson wrote:
>
>
>
> > I have written my first module called "logger" that logs to syslog via
> > the syslog module but also allows forloggingto STDOUT in debug mode
> > at multiple levels (to increase verbosity depending on one's
On Mar 5, 9:29 pm, Pete Emerson wrote:
>
> I have written my first module called "logger" that logs to syslog via
> the syslog module but also allows forloggingto STDOUT in debug mode
> at multiple levels (to increase verbosity depending on one's need), or
> both. I've looked at theloggingmodule a
On 3/5/2010 4:29 PM, Pete Emerson wrote:
On Mar 5, 1:14 pm, Chris Rebert wrote:
I want to write other modules, and my thinking is that it makes sense
for those modules to use the "logger" module to do the logging, if and
only if the parent using the other modules is also using the logger
modu
On Mar 5, 1:14 pm, Chris Rebert wrote:
> On Fri, Mar 5, 2010 at 12:25 PM, Pete Emerson wrote:
> > On Fri, Mar 5, 2010 at 12:17 PM, Chris Rebert wrote:
> >> On 3/5/10, Pete Emerson wrote:
> >>> In a module, how do I create a conditional that will do something
> >>> based on whether or not anothe
On Fri, Mar 5, 2010 at 12:25 PM, Pete Emerson wrote:
> On Fri, Mar 5, 2010 at 12:17 PM, Chris Rebert wrote:
>> On 3/5/10, Pete Emerson wrote:
>>> In a module, how do I create a conditional that will do something
>>> based on whether or not another module has been loaded?
>>> If someone is using
On Mar 5, 11:57 am, MRAB wrote:
> Pete Emerson wrote:
> > In a module, how do I create a conditional that will do something
> > based on whether or not another module has been loaded?
>
> > Suppose I have the following:
>
> > import foo
> > import foobar
>
> > print foo()
> > print foobar()
>
> >
On Mar 5, 12:06 pm, "Martin P. Hellwig"
wrote:
> On 03/05/10 19:24, Pete Emerson wrote:
>
> > In a module, how do I create a conditional that will do something
> > based on whether or not another module has been loaded?
> >
> > If someone is using foo module, I want to take advantage of its
> > fe
On Fri, Mar 5, 2010 at 12:17 PM, Chris Rebert wrote:
> On 3/5/10, Pete Emerson wrote:
>> In a module, how do I create a conditional that will do something
>> based on whether or not another module has been loaded?
>>
>> Suppose I have the following:
>>
>> import foo
>> import foobar
>>
>> print f
On 3/5/10, Pete Emerson wrote:
> In a module, how do I create a conditional that will do something
> based on whether or not another module has been loaded?
>
> Suppose I have the following:
>
> import foo
> import foobar
>
> print foo()
> print foobar()
>
> ### foo.py
> def foo:
>retu
On 03/05/10 19:24, Pete Emerson wrote:
In a module, how do I create a conditional that will do something
based on whether or not another module has been loaded?
>
If someone is using foo module, I want to take advantage of its
features and use it in foobar, otherwise, I want to do something els
Pete Emerson wrote:
In a module, how do I create a conditional that will do something
based on whether or not another module has been loaded?
Suppose I have the following:
import foo
import foobar
print foo()
print foobar()
### foo.py
def foo:
return 'foo'
### foobar.py
d
Pete Emerson wrote:
> In a module, how do I create a conditional that will do something
> based on whether or not another module has been loaded?
>
> Suppose I have the following:
>
> import foo
> import foobar
>
> print foo()
> print foobar()
>
By the way, the above statements are never going
On Fri, 05 Mar 2010 11:24:44 -0800, Pete Emerson wrote:
> In a module, how do I create a conditional that will do something based
> on whether or not another module has been loaded?
try:
import foo
except ImportError:
foo = None
def function():
if foo:
return foo.func()
e
Pete Emerson wrote:
> In a module, how do I create a conditional that will do something
> based on whether or not another module has been loaded?
>
> Suppose I have the following:
>
> import foo
> import foobar
>
> print foo()
> print foobar()
>
> ### foo.py
> def foo:
> return 'foo
On Mar 5, 11:24 am, Pete Emerson wrote:
> In a module, how do I create a conditional that will do something
> based on whether or not another module has been loaded?
>
> Suppose I have the following:
>
> import foo
> import foobar
>
> print foo()
> print foobar()
>
> ### foo.py
> def foo:
21 matches
Mail list logo