
Intermediate Python - heyalexej
http://book.pythontips.com
======
yasoob
Hi guys! I am the author of this book. Thanks heyalexej for posting this here.
If there is anything I can help you guys with then kindly let me know. :)

~~~
mhurron
Thank you for making the PDF available.

~~~
yasoob
You are welcome kind stranger! :)

~~~
camperman
Where can I download it please?

Edit: Never mind - I hadn't noticed you've added targets to the Makefile :)
Thanks.

------
nstart
Brilliant. Every language should have a book like this. I'm already learning a
lot of little details about features I've had some passing experience on. Only
request I have (which I generally have for stuff like this), is for real life
use cases. Example would be _args and_ *kwargs being used in decorators. Where
do you use it? What's a real life example of it being used? How does that
compare to the in built decorator functionality of Python? Answering this type
of question helps people understand the technique and theory in equal measures
as opposed to more theory than technique.

Thanks again for this :).

~~~
n0us
I use decorators like that in Django where I want to reuse the same code to
check something on the request object but the functions I am decorating expect
keyword arguments

~~~
nstart
I've been thinking of something like this for models especially. Where I have
made my own models and worked with Flask, but now need to integrate the Django
framework. Just a vague idea though. Haven't formed a clear picture of how
I'll do it at all

------
3pt14159
Map and filter are looked down upon by some Python devs because they prefer
list comprehensions. If you don't need the laziness (in Python 3 only), you
probably shouldn't use them because some don't consider them idiomatic. See
this for more information:

[http://stackoverflow.com/a/6407222/384700](http://stackoverflow.com/a/6407222/384700)

~~~
ggchappell
> If you don't need the laziness (in Python 3 only), you probably shouldn't
> use them ....

And if you _do_ need the laziness, then you can use generator comprehensions.

------
heyalexej
From related Reddit thread[0]:

 _Note: This is not related with that paid "intermediate Python" book in any
way. I became aware of it today. I had been using this name internally for a
couple of months. If the author of paid "Intermediate Python" has any issue
with this I would be more than happy to change the name of my book because he
definitely beated me to the finish line. :)_

[0] [http://redd.it/3hbb46](http://redd.it/3hbb46)

~~~
segmondy
I think you should change it to reduce confusion. "Intermediate Python
Programming" should be good enough.

~~~
mtinkerhess
On the other hand, the name "Intermediate Python" is so generic that whoever
wrote the book shouldn't be surprised there are other documents using the same
name.

------
teekert
I love it, as a biologist I did a Python course some months ago, already I'm
much more productive than I was in my Origin/Excel time. this books really
clarifies many of those strange things (like kwargs etc). This is going
straight into my favorites and I know I'll be using it often. Thanx!!!

~~~
yasoob
I love to read such comments. They help to fuel me. :)

Let me know how you use this book! And kindly share it with your peers. Best
of luck!

------
yasoob
I have put a link to a mailing list. If you want to tip me then kindly signup
over there and I would let you know once I have a tip receiving system in
place. I already run a reputed [Python Weekly
Newsletter]([http://newsletter.pythontips.com/](http://newsletter.pythontips.com/))
so you are in a good company (meaning I won't spam you).

Mailing list: [http://eepurl.com/bwjcej](http://eepurl.com/bwjcej)

------
SEJeff
And if anyone wants to add / enhance this here you go:

[https://github.com/IntermediatePython/intermediatePython](https://github.com/IntermediatePython/intermediatePython)

------
rectangletangle

        from contextlib import contextmanager
    

I love this feature, I never forget to close a connection. It can also be
useful for monkey patching, or thread local variable based optimizations.

------
TheGRS
This looks great just from glancing over the table of contents. I picked up
Python nearly a year ago and I am a pretty novice programmer at best. Over
time I've learned stuff like decorators, lambas, args/kwargs and other stuff
that you generally don't find in the "Intro to Python" books, but its all been
through stumbling into the right place. Thanks for sharing, I may have
something to read this week :)

------
snurk
Shit, what I need is "How to publish a package to PyPi in 3 easy steps."

I go around and round with the Python Packaging Authority's documentation.

~~~
damon_c
I learned from this: [http://peterdowns.com/posts/first-time-with-
pypi.html](http://peterdowns.com/posts/first-time-with-pypi.html)

Not bad.

~~~
snurk
thanks! that looks super easy. last time i tried, i rage-quit.

~~~
Wilduck
It has been much more difficult in the past, as recently as 2013, there were a
number of different tools competing to be the standard method of packaging
python. It's pretty smooth sailing at this point.

I actually gave a lightning talk on this topic a couple months ago. Here are
my slides, in case they're useful:
[https://docs.google.com/presentation/d/13Cd-
LIcw38d-zwZ5pGiW...](https://docs.google.com/presentation/d/13Cd-
LIcw38d-zwZ5pGiWmAtmaxXeamyDe3oe13Le3dw/edit?usp=sharing)

------
olenhad
Great job @yasoob! What's even more amazing, even thought not directly
relevant, is that the author is still in high school.

------
leni536
I just skimmed through decorators. I don't use python too much and decorators
always seemed a little bit black magic for me. Thanks for proving this wrong.

------
yasoob
You guys can donate me if you want to by buying the donation version of
Intermediate Python from
[@gumroad]([https://gumroad.com/l/intermediate_python](https://gumroad.com/l/intermediate_python))
:)

It is only for $10 but if you want to pay less then kindly let me know (pm)
and I can give you a custom link.

Cheers!

------
jeremiecoullon
Thanks for this! It's really good to have intermediate stuff all in one place,
rather than tutorials on a specific topic

------
omegote
Nice, I've shared it in my social networks.

As for a supposed "Advanced Python" edition, it would be great to compile at
least a list of topics that could be interesting. Some have been already
mentioned in this thread, like:

    
    
      - Metaclasses
      - Packaging (for pypi)
    

I'd add:

    
    
      - Must-have libraries
      - Testing

~~~
alexchamberlain
Whilst I don't buy into the TDD fad, Testing should not be an advanced topic.

~~~
ersii
Test Driven Development (TDD) may or may not be a fad. Regardless, one can
always have testing in ones development work. That doesn't mean you're driven
by the tests.

Edit: On second thought, I read your comment sloppily. I agree, testing in
itself isn't an advanced topic and I'd recommend a section on some testing :-)

------
jqm
I like it. Really good.

The only point, I might not consider lists being mutable nor global values vs
values returned from a function intermediate topics. Those are beginner topics
I think.. one would have a hard time using the language almost at all without
understanding them. I would say the part about decorators and _kwargs_ args is
more intermediate level. Anyone who gets to that probably already understands
global variables and the fact certain data structures are mutable.

But not abuse your work. The book is nice. I learned a couple of things.

~~~
yasoob
Hey! There is no problem with correcting me. If you think that I missed
something or if there is something that can be improved and you think that you
can make it much better then submit a pull request if you can. :) I would be
more than happy to accept it.

Here is the GitHub repo:
[https://github.com/IntermediatePython/intermediatePython](https://github.com/IntermediatePython/intermediatePython)

------
opmac
Really good stuff here, and well put together.

------
0x29A-
Is there anything like this site for Java?

~~~
Scarbutt
Effective Java by Joshua Bloch

------
potatosareok
Another useful brief overview -
[http://python.net/~goodger/projects/pycon/2007/idiomatic/han...](http://python.net/~goodger/projects/pycon/2007/idiomatic/handout.html)

------
sateesh
I see that that the book has a section on usage of For-Else construct.
Personally I found this construct to be confusing, and avoid its usage as one
can achieve the same by setting a flag (say). Is this construct much used ?

~~~
yasoob
No. It is not used widely. AFAIK.

~~~
sateesh
Then probably it might be a good idea to add a note about avoiding its usage
in your book. Thanks for the book and making it available for free.

------
p1esk
Another "Intermediate Python" book:
[http://www.amazon.com/dp/149055095X](http://www.amazon.com/dp/149055095X)

~~~
yasoob
That is totally different from my book :) I haven't read it so I can not tell
how much different it is from mine. Perhaps you can tell if you have read it?

~~~
iheartmemcache
I was right about to buy it, completely blind, based on the similar title,
because a good deed deserves a good deed: I support anyone who gives their
book away for free online and offers a hard-copy (Learn You a Haskell, I'm
looking at you) for purchase.

Let me know if you have an Amazon affiliate link, tipjar, or need help with
any projects.

Edit: whoa, at least 5 redditors had the same "do you have a paypal?"
sentiment. I suggest you have a header on visit and start collecting opt-in
emails. That way, people like me will be emailed the second you get all setup.

Edit 2: Also, this definitely is a good "resume" for consulting work. I'd put
an "Available for Hire/Retainer" notice at the header of every page, in case
someone has an overflow of work, and/or a corporate manager wants a flexible
contractor asset available as an insurance policy for behind-schedule
projects. Don't charge less than 150/hr in 20 hour blocks per month for
retainer work (use it or lose it), and 175ish/hr for active work.

~~~
c4obi
[https://leanpub.com/intermediatepython](https://leanpub.com/intermediatepython)
author here.. Did you get to take a look at the book? It is actually free of
charge on Leanpub

------
whocanfly
This is great! You can make an ipython notebook version of this too.

------
objectified
Really good stuff in here, thanks for this. Are there any plans to follow this
up with something along the lines of "Advanced Python"?

~~~
SEJeff
Just go read David Beazely's site for that. Seriously

[http://www.dabeaz.com/blog.html](http://www.dabeaz.com/blog.html)

A few good ones for reference:

[http://www.dabeaz.com/generators/](http://www.dabeaz.com/generators/)

[https://www.youtube.com/watch?v=fwzPF2JLoeU](https://www.youtube.com/watch?v=fwzPF2JLoeU)

~~~
yasoob
I love his work and I honestly recommend it to you guys! :)

------
vchynarov
It's interesting how a search for "metaclasses" in the given link doesn't
yield any results.

~~~
yasoob
That is advanced level stuff :) If you want to add it to this book then kindly
go ahead. This book is open source.

~~~
FilterSweep
It's certainly an arduous task to determine what is intermediate and what
isn't! And I think you did an excellent job, from looking at the table of
contents (I'll have to take a closer look and have booked marked it for
later). Unlike some the above posters, I learned metaclasses relatively early,
but there are definitely some things in this book which I haven't seen before.
Thank you.

