Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #20091 > unrolled thread

Guide to: Learning Python Decorators

Started bysajuptpm <sajuptpm@gmail.com>
First post2012-02-09 09:56 -0800
Last post2012-02-12 04:04 -0500
Articles 10 — 6 participants

Back to article view | Back to comp.lang.python


Contents

  Guide to: Learning Python Decorators sajuptpm <sajuptpm@gmail.com> - 2012-02-09 09:56 -0800
    Re: Guide to: Learning Python Decorators Terry Reedy <tjreedy@udel.edu> - 2012-02-09 15:28 -0500
    Re: Guide to: Learning Python Decorators Ian <hobson42@gmail.com> - 2012-02-09 22:43 +0000
    Re: Guide to: Learning Python Decorators Terry Reedy <tjreedy@udel.edu> - 2012-02-09 22:22 -0500
      Re: Guide to: Learning Python Decorators sajuptpm <sajuptpm@gmail.com> - 2012-02-09 22:20 -0800
    Re: Guide to: Learning Python Decorators anon hung <anonhung@gmail.com> - 2012-02-10 07:32 +0100
      Re: Guide to: Learning Python Decorators 88888 Dihedral <dihedral88888@googlemail.com> - 2012-02-12 03:48 -0800
      Re: Guide to: Learning Python Decorators 88888 Dihedral <dihedral88888@googlemail.com> - 2012-02-12 03:48 -0800
    Re: Guide to: Learning Python Decorators 88888 Dihedral <dihedral88888@googlemail.com> - 2012-02-10 00:11 -0800
      Re: Guide to: Learning Python Decorators Jack Diederich <jackdied@gmail.com> - 2012-02-12 04:04 -0500

#20091 — Guide to: Learning Python Decorators

Fromsajuptpm <sajuptpm@gmail.com>
Date2012-02-09 09:56 -0800
SubjectGuide to: Learning Python Decorators
Message-ID<476f8fff-9f08-4a54-8704-449cfaf6ad60@vv9g2000pbc.googlegroups.com>
Guide to: Learning Python Decorators
New Book http://tinyurl.com/python-decorartor

[toc] | [next] | [standalone]


#20105

FromTerry Reedy <tjreedy@udel.edu>
Date2012-02-09 15:28 -0500
Message-ID<mailman.5609.1328819347.27778.python-list@python.org>
In reply to#20091
On 2/9/2012 1:55 PM, Arnaud Delobelle wrote:
>
> On Feb 9, 2012 6:00 PM, "sajuptpm" <sajuptpm@gmail.com
> <mailto:sajuptpm@gmail.com>> 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

[toc] | [prev] | [next] | [standalone]


#20122

FromIan <hobson42@gmail.com>
Date2012-02-09 22:43 +0000
Message-ID<mailman.5622.1328833227.27778.python-list@python.org>
In reply to#20091
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

[toc] | [prev] | [next] | [standalone]


#20133

FromTerry Reedy <tjreedy@udel.edu>
Date2012-02-09 22:22 -0500
Message-ID<mailman.5632.1328844192.27778.python-list@python.org>
In reply to#20091
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

[toc] | [prev] | [next] | [standalone]


#20141

Fromsajuptpm <sajuptpm@gmail.com>
Date2012-02-09 22:20 -0800
Message-ID<b7d2bd56-69b6-4ddb-878e-a898967a0dc6@pq6g2000pbc.googlegroups.com>
In reply to#20133
Hi,

Thanks for replay,
I am looking for PDF version of same book. Please share if you can.

http://www.amazon.com/gp/product/B006ZHJSIM/ref=as_li_tf_tl?ie=UTF8&tag=8012-20&linkCode=as2&camp=1789&creative=9325&creativeASIN=B006ZHJSIM

[toc] | [prev] | [next] | [standalone]


#20144

Fromanon hung <anonhung@gmail.com>
Date2012-02-10 07:32 +0100
Message-ID<mailman.5640.1328855534.27778.python-list@python.org>
In reply to#20091
>> 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

[toc] | [prev] | [next] | [standalone]


#20265

From88888 Dihedral <dihedral88888@googlemail.com>
Date2012-02-12 03:48 -0800
Message-ID<7765462.72.1329047312690.JavaMail.geo-discussion-forums@pbcql8>
In reply to#20144
在 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.

[toc] | [prev] | [next] | [standalone]


#20266

From88888 Dihedral <dihedral88888@googlemail.com>
Date2012-02-12 03:48 -0800
Message-ID<mailman.5722.1329047323.27778.python-list@python.org>
In reply to#20144
在 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.

[toc] | [prev] | [next] | [standalone]


#20148

From88888 Dihedral <dihedral88888@googlemail.com>
Date2012-02-10 00:11 -0800
Message-ID<7265933.362.1328861473828.JavaMail.geo-discussion-forums@prew38>
In reply to#20091
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. 

[toc] | [prev] | [next] | [standalone]


#20258

FromJack Diederich <jackdied@gmail.com>
Date2012-02-12 04:04 -0500
Message-ID<mailman.5719.1329037484.27778.python-list@python.org>
In reply to#20148
just google "jack diederich decorators" it costs nothing and you get a
free pycon talk out of it.

-Jack

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web