improvements for the logging package

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Thomas Heller

    #16
    Re: improvements for the logging package

    Peter Otten <__peter__@web. de> writes:
    [color=blue]
    > Thomas Heller wrote:
    >[color=green][color=darkred]
    >>> OK, it's not right at the top of the docs, but the example at
    >>>
    >>> http://docs.python.org/lib/minimal-example.html
    >>>
    >>> has been there for a while, and if you think it can be made clearer,
    >>> please suggest how.[/color]
    >>
    >> Maybe I'm missing something, but the code from the example doesn't work
    >> for me:
    >>
    >>[color=darkred]
    >>>>> import logging
    >>>>>
    >>>>> logging.basicCo nfig(level=logg ing.DEBUG,[/color]
    >> ... format='%(ascti me)s %(levelname)s %(message)s',
    >> ... filename='/tmp/myapp.log',
    >> ... filemode='w')
    >> Traceback (most recent call last):
    >> File "<stdin>", line 4, in ?
    >> TypeError: basicConfig() takes no arguments (4 given)[color=darkred]
    >>>>>[/color][/color]
    >
    > Are you perhaps trying to teach the 2.3 library a trick from the 2.4 docs?[/color]

    Yes, it seems so. Although I would have expected the documentation to
    inform me about incompatible changes in the api.

    Thomas

    Comment

    • skip@pobox.com

      #17
      Re: improvements for the logging package


      Vinay> Well, it seems a little too late now, for unittest, threading, logging
      Vinay> and probably a few more.

      Correct, as I indicated.
      [color=blue][color=green]
      >> I realize I'm playing the devil's advocate here.... Still, a dual
      >> naming scheme with the non-PEP-8 names deprecated should be possible.[/color][/color]

      Vinay> The breakage in my own usage of the module, and that of some
      Vinay> existing users of the logging module in its pre-stdlib days,
      Vinay> seemed to me to be good enough reason to leave the naming
      Vinay> alone.

      That's fine, but once your code works its way into the core, it effectively
      serves a different master. Many people use code in the core as examples of
      how to write Python.

      As for renaming/deprecating, that mechanically seems pretty straightforward
      to me:

      def basic_config(.. .):
      blah blah blah
      basicConfig = basic_config

      Then you go through the official deprecation process (pending deprecation in
      2.N, deprecation in 2.N+1, remove it in 2.N+2).

      Vinay> Certainly, I was aware that the stdlib at that time contained
      Vinay> both naming styles. Certainly the package did not have a long and
      Vinay> stable life before coming into stdlib, but neither was it written
      Vinay> from scratch for inclusion in the core.

      My apologies. I thought it was.

      Vinay> What would you suggest for threading, unittest etc. in terms of
      Vinay> binding more unix_like_names and deprecating existing ones? It
      Vinay> seems a lot of work for not very much benefit, beyond consistency
      Vinay> for its own sake.

      No, while "consistenc y is the hobgoblin of little minds" I think we should
      strive for consistency within the core code, simply because it tends to be
      used as an informal educational tool. As for the others (and logging as
      well, for that matter), maybe it's just been too long to make changes and
      they should only be changed in Py3K.

      Skip

      Comment

      • Mike C. Fletcher

        #18
        Re: improvements for the logging package

        skip@pobox.com wrote:
        [color=blue]
        > Vinay> Well, it seems a little too late now, for unittest, threading, logging
        > Vinay> and probably a few more.
        >
        >Correct, as I indicated.
        >
        >[/color]
        ....
        [color=blue]
        > Vinay> What would you suggest for threading, unittest etc. in terms of
        > Vinay> binding more unix_like_names and deprecating existing ones? It
        > Vinay> seems a lot of work for not very much benefit, beyond consistency
        > Vinay> for its own sake.
        >
        >No, while "consistenc y is the hobgoblin of little minds" I think we should
        >strive for consistency within the core code, simply because it tends to be
        >used as an informal educational tool. As for the others (and logging as
        >well, for that matter), maybe it's just been too long to make changes and
        >they should only be changed in Py3K.
        >
        >[/color]
        I would strongly support the assertion that changing the interfaces on
        deployed modules just to match the style guide is not something that
        should happen before Py3K (that is to say, it should not happen until we
        simply don't care about being able to run old Python code, which is to
        say, a very long time).

        There's no reason whatsoever to break *every* piece of code that ever
        used a service just to support consistency in naming. Especially when
        you're dealing with these modules that are used in probably the majority
        of projects it's just a *huge* make-work project to go removing the
        original service (API). If someone really wants the newly-named
        version, create a different entry-point (module) and allow them to use
        that. See how popular the renamed version is as a stand-alone module
        where the barrier to entry is copying it in (which is far less than
        revising hundreds of projects to deal with a deprecation). If it flies,
        consider adding it to the standard library and eventually deprecating
        the current version.

        Consistency in the standard library is good. We *should* strive for it
        as we improve the library. But reworking elements in the standard
        library *just* to support consistency, at the expense of complete API
        incompatibility , just doesn't have a good cost/benefit ratio for the
        *users* of Python. A note in the docstring and documentation noting the
        inconsistency in naming due to historic factors would seem to be more
        appropriate if we're worried about emulation by users.

        Anyway, I realise Skip probably was using "in Py3K" in the "some
        unimaginably far-off time" sense, but just in case he wasn't I felt I
        should pipe up...
        Mike

        --
        _______________ _______________ _______________ ___
        Mike C. Fletcher
        Designer, VR Plumber, Coder



        Comment

        • Vinay Sajip

          #19
          Re: improvements for the logging package


          Thomas Heller wrote:[color=blue]
          > Yes, it seems so. Although I would have expected the documentation to
          > inform me about incompatible changes in the api.[/color]

          It does, in the "in-development" version of the documentation. Sorry it
          was not in the 2.4 releases :-(



          Regards,

          Vinay

          Comment

          • Thomas Heller

            #20
            Re: improvements for the logging package

            "Vinay Sajip" <vinay_sajip@ya hoo.co.uk> writes:
            [color=blue]
            > Thomas Heller wrote:[color=green]
            >> Yes, it seems so. Although I would have expected the documentation to
            >> inform me about incompatible changes in the api.[/color]
            >
            > It does, in the "in-development" version of the documentation. Sorry it
            > was not in the 2.4 releases :-(
            >[/color]

            Maybe it can be backported to 2.4.2 - is there still time for that?

            Thomas

            Comment

            • skip@pobox.com

              #21
              Re: improvements for the logging package

              >> It does, in the "in-development" version of the documentation. Sorry it[color=blue][color=green]
              >> was not in the 2.4 releases :-([/color][/color]

              Thomas> Maybe it can be backported to 2.4.2 - is there still time for that?

              Changed now in CVS. When 2.4.2 is released it should be there.

              Skip

              Comment

              • Trent Mick

                #22
                Re: improvements for the logging package

                [skip@pobox.com wrote][color=blue][color=green][color=darkred]
                > >> It does, in the "in-development" version of the documentation. Sorry it
                > >> was not in the 2.4 releases :-([/color][/color]
                >
                > Thomas> Maybe it can be backported to 2.4.2 - is there still time for that?
                >
                > Changed now in CVS. When 2.4.2 is released it should be there.[/color]

                Is this the same kind of thing as the (generally ill-regarded) change in
                Python 2.2.x (for some x != 0) that added:
                True, False = 0, 1
                I may have the details wrong.

                Now there is a feature in 2.4.x that wasn't in 2.4.(x-1), which could
                cause surprises. I.e. I write code that uses the new thing, test it with
                my 2.4.2 install, think that is works with 2.4.* and say so when I
                distribute it.

                Maybe that is okay. Just asking here because I don't keep up with
                Python changes -- or sentiment on how to handle this kind of thing --
                well enough.

                Trent

                --
                Trent Mick
                TrentM@ActiveSt ate.com

                Comment

                • skip@pobox.com

                  #23
                  Re: improvements for the logging package

                  [color=blue][color=green]
                  >> Changed now in CVS. When 2.4.2 is released it should be there.[/color][/color]

                  Trent> Is this the same kind of thing as the (generally ill-regarded)
                  Trent> change in Python 2.2.x (for some x != 0) that added:

                  No, I just backported the documentation bit that marked the keyword
                  parameter change to basicConfig() as happening in 2.4. I didn't change any
                  code.

                  Skip

                  Comment

                  • Trent Mick

                    #24
                    Re: improvements for the logging package

                    [skip@pobox.com wrote][color=blue]
                    >[color=green][color=darkred]
                    > >> Changed now in CVS. When 2.4.2 is released it should be there.[/color][/color]
                    >
                    > Trent> Is this the same kind of thing as the (generally ill-regarded)
                    > Trent> change in Python 2.2.x (for some x != 0) that added:
                    >
                    > No, I just backported the documentation bit that marked the keyword
                    > parameter change to basicConfig() as happening in 2.4. I didn't change any
                    > code.[/color]

                    Duh. Sorry.

                    Trent

                    --
                    Trent Mick
                    TrentM@ActiveSt ate.com

                    Comment

                    Working...