Re: [Python-Dev] Using logging in the stdlib and its unit tests

2010-12-12 Thread Nick Coghlan
On Mon, Dec 13, 2010 at 2:13 PM, Robert Kern wrote: >>> level = logging._levelNames[opt.logLevel] >> >> That doesn't work (_levelNames maps from integers to strings, we want >> the mapping from strings to integers and it is only the module globals >> that provides that). > > At least in Python 2.6

Re: [Python-Dev] Using logging in the stdlib and its unit tests

2010-12-12 Thread Robert Kern
On 2010-12-12 21:30 , Nick Coghlan wrote: On Mon, Dec 13, 2010 at 11:22 AM, Robert Kern wrote: level = getattr(logging, opt.logLevel) While this is the approach I would recommend, it does have a couple of downsides: 1. An upper() call is also needed to allow strings like "info" instead of "I

Re: [Python-Dev] [Python-checkins] r87202 - python/branches/py3k/Doc/library/logging.rst

2010-12-12 Thread Nick Coghlan
On Mon, Dec 13, 2010 at 8:45 AM, vinay.sajip wrote: > +to get the value which you'll pass to :func:`basicConfig` via the *level* > +argument. You may want to error check any user input value, perhaps as in the > +following example:: > + > +   # assuming loglevel is bound to the string value obtain

Re: [Python-Dev] Using logging in the stdlib and its unit tests

2010-12-12 Thread Nick Coghlan
On Mon, Dec 13, 2010 at 11:22 AM, Robert Kern wrote: > level = getattr(logging, opt.logLevel) While this is the approach I would recommend, it does have a couple of downsides: 1. An upper() call is also needed to allow strings like "info" instead of "INFO": 2. If an integer is available, it woul

Re: [Python-Dev] Using logging in the stdlib and its unit tests

2010-12-12 Thread Robert Kern
On 2010-12-12 18:42 , Glenn Linderman wrote: On 12/12/2010 2:26 PM, Paul Moore wrote: The thing*I* hit very early was wanting to add a command lime option to my script to set the logging level. I'd have liked to be able to add --log=INFO/DEBUG/... but to do that I seem to need to write my own m

Re: [Python-Dev] Using logging in the stdlib and its unit tests

2010-12-12 Thread Glenn Linderman
On 12/12/2010 9:41 AM, Vinay Sajip wrote: Gosh, Nick, that was fast! I'm still making changes, but thanks for spotting and highlighting the typos and omissions. I've just checked in a further update; hopefully it'll get built soon so we can all see the latest changes. I'm not as fast as Nick, b

Re: [Python-Dev] Using logging in the stdlib and its unit tests

2010-12-12 Thread Glenn Linderman
On 12/12/2010 2:26 PM, Paul Moore wrote: The thing*I* hit very early was wanting to add a command lime option to my script to set the logging level. I'd have liked to be able to add --log=INFO/DEBUG/... but to do that I seem to need to write my own mapping between level names and numbers. A simp

Re: [Python-Dev] Using logging in the stdlib and its unit tests

2010-12-12 Thread Éric Araujo
Hi, I suggest to replace “error” with “event” in the module doc synopsis. Regards ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archi

Re: [Python-Dev] use case for bytes.format

2010-12-12 Thread Terry Reedy
On 12/12/2010 2:04 PM, Zeljko wrote: This post should have gone to python-list, mirrored as gmane.comp.python.general. Please limit any further response to either of those (or c.l.p) and delete pydev. I'm considering to write some pure python pdf lib from from scratch, but found there is no

Re: [Python-Dev] Using logging in the stdlib and its unit tests

2010-12-12 Thread Paul Moore
On 10 December 2010 20:57, Glenn Linderman wrote: > On 12/10/2010 12:49 PM, Antoine Pitrou wrote: > > And yet, I have helped many people who were baffled by exactly what >> Bill observed: logging.info() didn't do anything. Maybe the default >> should be INFO? > > Funny, because displaying only err

[Python-Dev] use case for bytes.format

2010-12-12 Thread Zeljko
I'm considering to write some pure python pdf lib from from scratch, but found there is no built-in formating for bytes. It's very frustrating to use some inefficient surogate funtion, which is gong to be called thousands times. ___ Python-Dev mail

Re: [Python-Dev] Using logging in the stdlib and its unit tests

2010-12-12 Thread Vinay Sajip
Nick Coghlan gmail.com> writes: Gosh, Nick, that was fast! I'm still making changes, but thanks for spotting and highlighting the typos and omissions. I've just checked in a further update; hopefully it'll get built soon so we can all see the latest changes. Regards, Vinay Sajip __

Re: [Python-Dev] API for the new sysconfig module

2010-12-12 Thread Tarek Ziadé
On Sun, Dec 12, 2010 at 3:05 PM, Barry Warsaw wrote: > On Dec 12, 2010, at 02:42 PM, Antoine Pitrou wrote: > >>On Sun, 12 Dec 2010 13:01:42 +0100 >>Łukasz Langa wrote: >> >>> Wiadomość napisana przez Raymond Hettinger w dniu 2010-12-11, o godz. 22:18: >>> >>> >> *(I sometimes lose track of which

Re: [Python-Dev] API for the new sysconfig module

2010-12-12 Thread Stefan Krah
Lukasz Langa wrote: > Wiadomość napisana przez Raymond Hettinger w dniu 2010-12-11, o godz. 22:18: > > Right. I missed that it was already in 2.7. > So, now we're stuck with it, forever. > > Why not deprecate it for 3.2 (easy since it's probably not yet used anywhere > anyway, even in 2

Re: [Python-Dev] Using logging in the stdlib and its unit tests

2010-12-12 Thread Nick Coghlan
On Sun, Dec 12, 2010 at 5:32 AM, Brett Cannon wrote: > On Fri, Dec 10, 2010 at 22:21, Vinay Sajip wrote: >> Nick Coghlan gmail.com> writes: >> >> >>> This could actually make a reasonably good basic for a "task oriented" >>> subsection of the logging documentation. Something like: >>> >> >> Good

Re: [Python-Dev] API for the new sysconfig module

2010-12-12 Thread Nick Coghlan
On Sun, Dec 12, 2010 at 11:42 PM, Antoine Pitrou wrote: >> I really like that much better than Java-like accessor functions. > > Do you actually use sysconfig yourself? It's quite a specialized > module, and I don't think API elegance arguments have a great weight > here. I would also like those

Re: [Python-Dev] API for the new sysconfig module

2010-12-12 Thread Barry Warsaw
On Dec 12, 2010, at 02:42 PM, Antoine Pitrou wrote: >On Sun, 12 Dec 2010 13:01:42 +0100 >Łukasz Langa wrote: > >> Wiadomość napisana przez Raymond Hettinger w dniu 2010-12-11, o godz. 22:18: >> >> >> *(I sometimes lose track of which changes were made in both branches >> >> pre-2.7, which ones w

Re: [Python-Dev] API for the new sysconfig module

2010-12-12 Thread Antoine Pitrou
On Sun, 12 Dec 2010 13:01:42 +0100 Łukasz Langa wrote: > Wiadomość napisana przez Raymond Hettinger w dniu 2010-12-11, o godz. 22:18: > > >> *(I sometimes lose track of which changes were made in both branches > >> pre-2.7, which ones were mode post-2.7 release, and which ones went in > >> pre-2

Re: [Python-Dev] API for the new sysconfig module

2010-12-12 Thread Łukasz Langa
Wiadomość napisana przez Raymond Hettinger w dniu 2010-12-11, o godz. 22:18: >> *(I sometimes lose track of which changes were made in both branches >> pre-2.7, which ones were mode post-2.7 release, and which ones went in >> pre-2.7, but were 3.x only regardless) > > Right. I missed that it was