Guide to: Learning Python Decorators

Discussion in 'Python' started by sajuptpm, Feb 9, 2012.

  1. sajuptpm

    sajuptpm Guest

    sajuptpm, Feb 9, 2012
    #1
    1. Advertising

  2. sajuptpm

    Terry Reedy Guest

    On 2/9/2012 1:55 PM, Arnaud Delobelle wrote:
    >
    > On Feb 9, 2012 6:00 PM, "sajuptpm" <
    > <mailto:>> wrote:
    > >
    > > Guide to: Learning Python Decorators
    > > New Book http://tinyurl.com/python-decorartor


    Which goes to Amazon, perhaps with an Amazon Associate id embedded.

    > A whole book about decorators? Cool. I'm going to start writing books
    > to. I'll start with 'The Python print statement'. Then to be cutting
    > edge I'll follow with 'The Python print function'.


    Sarcasm aside, it is a small (200K) digital book at a small price ($4).
    According to the 5-star reviews, it is not as trivial as the title
    indicates. It starts with explaining functions, scope, parameters,
    nesting, *args, **kwds, and nesting. In other words, everything one
    needs to know to understand decorators. It is based on tutorials given
    at PyCon and elsewhere. I plan to borrow it and take a look.

    A book on Printing with Python that clearly explained everything one
    needs to know about characters, glyphs, fonts, bytes, unicode,
    encodings, and serialization in order to print would also be worthwhile.
    For a bonus, add in something about console windows, OS differences, and
    printers.

    --
    Terry Jan Reedy
     
    Terry Reedy, Feb 9, 2012
    #2
    1. Advertising

  3. sajuptpm

    Ian Guest

    On 09/02/2012 21:41, Aaron France wrote:
    > How many pages is that? The amazon page conveniently left that off.

    There is an average of 5.1 chars per word in English, and usually about
    350 words an A4 page.

    The 215K file is
    a) Compressed - typically by 60%
    b) Contains simple html and images as its source.
    c) Must contain the cover image.

    As a *very* rough guess, that means the files expands to 344K.

    Remove the cover image at 250-300kb leaves 44 to 94KB

    That is 8700 words to 18400 words or approx 25 to 50 pages.

    But that is *very* *very* rough.

    Regards

    Ian
     
    Ian, Feb 9, 2012
    #3
  4. sajuptpm

    Terry Reedy Guest

    On 2/9/2012 5:43 PM, Ian wrote:
    > On 09/02/2012 21:41, Aaron France wrote:
    >> How many pages is that? The amazon page conveniently left that off.

    > There is an average of 5.1 chars per word in English, and usually about
    > 350 words an A4 page.
    >
    > The 215K file is
    > a) Compressed - typically by 60%
    > b) Contains simple html and images as its source.
    > c) Must contain the cover image.
    >
    > As a *very* rough guess, that means the files expands to 344K.
    > Remove the cover image at 250-300kb leaves 44 to 94KB
    > That is 8700 words to 18400 words or approx 25 to 50 pages.
    > But that is *very* *very* rough.


    The file is about 500 'locations'. The Kindle Users Guide, 3rd Ed., has
    1300, Lao Tza, the Art of War, (project Gutenberg), aaabut 2100. I read
    about half in an hour. Even knowing the material, it is slower than a novel.

    --
    Terry Jan Reedy
     
    Terry Reedy, Feb 10, 2012
    #4
  5. sajuptpm

    sajuptpm Guest

    sajuptpm, Feb 10, 2012
    #5
  6. sajuptpm

    anon hung Guest

    >> Guide to: Learning Python Decorators
    >> New Book http://tinyurl.com/python-decorartor

    >
    > A whole book about decorators? Cool. I'm going to start writing books to.
    > I'll start with 'The Python print statement'. Then to be cutting edge I'll
    > follow with 'The Python print function'.


    How about 'Tips and tricks about python loops'?

    :)


    --
    Viktor Orban Prime minister of Hungary
    http://spreadingviktororban.weebly.com
     
    anon hung, Feb 10, 2012
    #6
  7. I prefer to decorate a function not a method.

    I prefer to decorate an object to own a new method from the existed ones
    inherited in all the class levels.

    I do not decorate a class if not necessary.

    I believe this is more pythonic to add functionalities to objects in classes by
    aggregated scripts that use similar modules over a period of time.
     
    88888 Dihedral, Feb 10, 2012
    #7
  8. just google "jack diederich decorators" it costs nothing and you get a
    free pycon talk out of it.

    -Jack
     
    Jack Diederich, Feb 12, 2012
    #8
  9. 在 2012å¹´2月10日星期五UTC+8下åˆ2æ—¶32分09秒,anon hung写é“:
    > >> Guide to: Learning Python Decorators
    > >> New Book http://tinyurl.com/python-decorartor

    > >
    > > A whole book about decorators? Cool. I'm going to start writing books to.
    > > I'll start with 'The Python print statement'. Then to be cutting edge I'll
    > > follow with 'The Python print function'.

    >

    There are books about classes in other computer languages, too.

    Using decorator is more elegant in reducing the class levels in applications.
    Just deep copying an object in more than 10 levels of an inherited class hiarchie is so slow.
     
    88888 Dihedral, Feb 12, 2012
    #9
  10. 在 2012å¹´2月10日星期五UTC+8下åˆ2æ—¶32分09秒,anon hung写é“:
    > >> Guide to: Learning Python Decorators
    > >> New Book http://tinyurl.com/python-decorartor

    > >
    > > A whole book about decorators? Cool. I'm going to start writing books to.
    > > I'll start with 'The Python print statement'. Then to be cutting edge I'll
    > > follow with 'The Python print function'.

    >

    There are books about classes in other computer languages, too.

    Using decorator is more elegant in reducing the class levels in applications.
    Just deep copying an object in more than 10 levels of an inherited class hiarchie is so slow.
     
    88888 Dihedral, Feb 12, 2012
    #10
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Arien Malec

    PEP 318 decorators are not Decorators

    Arien Malec, Aug 13, 2004, in forum: Python
    Replies:
    11
    Views:
    579
    Arien Malec
    Aug 16, 2004
  2. Hal Vaughan
    Replies:
    7
    Views:
    491
  3. Luc Juggery
    Replies:
    5
    Views:
    155
    Luc Juggery
    Oct 24, 2006
  4. Andrey Popp

    [I'm learning C]: Learning to use ucontext

    Andrey Popp, Jan 29, 2012, in forum: C Programming
    Replies:
    5
    Views:
    766
    Keith Thompson
    Jan 31, 2012
  5. Jason Meyer

    learning guide

    Jason Meyer, Sep 29, 2003, in forum: Javascript
    Replies:
    1
    Views:
    114
    kaeli
    Sep 30, 2003
Loading...

Share This Page