Guide to: Learning Python Decorators

T

Terry Reedy

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.
 
I

Ian

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
 
T

Terry Reedy

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.
 
A

anon hung

Guide to: Learning Python Decorators
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'?

:)
 
8

88888 Dihedral

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.
 
J

Jack Diederich

just google "jack diederich decorators" it costs nothing and you get a
free pycon talk out of it.

-Jack
 
8

88888 Dihedral

在 2012å¹´2月10日星期五UTC+8下åˆ2æ—¶32分09秒,anon hung写é“: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.
 
8

88888 Dihedral

在 2012å¹´2月10日星期五UTC+8下åˆ2æ—¶32分09秒,anon hung写é“: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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,049
Latest member
Allen00Reed

Latest Threads

Top