Type checking or hinting is a newer feature of Python that was added in Python 3.5. Type hinting is also known as type annotation. Type hinting is adding special syntax to functions and variable declarations that tell the developer what type the argument or variable is.
Python does not enforce the type hints. You can still change types at will in Python because of this. However some integrated development environments, such as PyCharm, support type hinting and will highlight typing errors. You can also use a tool called Mypy to check your typing for you. You will learn more about that tool later on in this article.
The original Python 101 was the first book I had ever written. In deciding to write a 2nd edition, I needed to decide what I should keep and what I should remove from the book. What I ended up doing was rewriting the book from the ground up.
In the original book, Python 101 was based on Python 3.5 and had the following sections:
Part I – Learning the basics
Part II – Learning from the library
Part III – Intermediate Odds and Ends
Part IV – Tips, tricks and tutorials
Part V – Packaging and Distribution
For the 2nd edition, I am dropping part II as most of that information can be covered in later chapters. Now that Python 3.8 is out, I am able to cover such things as
dictionaries being ordered by default
review questions for most chapters
And mention other neat things, like sub-interpreters, the futures module, and audit hooks, although those won’t be covered in detail. I am also planning on making the tutorials section into a more proof-of-concept section where you will have little useful scripts that you can take and use. That was already there to some degree, but I think these scripts will be even better than the original ones.
The distribution section will also get a makeover to cover the latest conventions for distributing your code to the Python Packaging Index. The original book’s coverage is out of date.
Also while the first book mentioned lots of different options for creating executables, the new version of the book will focus on only one or two, but it will show how to create a binary for Windows and Mac. I am investigating how to support Linux, but that may or may not be included.
I will be making quite a few chapters available in the free sample available on Leanpub so people can check it out before purchasing.
I hope you’ll check out the book. Feel free to ask questions in the comments or send me an email.
Python 101 2nd Edition will be released in September 2020
My Kickstarter for the 2nd Edition of Python 101 is ending in less than two days. If you want a signed copy or to purchase one of my other books for a discount, you should check out the Kickstarter as I have lots of good deals on there.
Also, note that the 2nd Edition of Python 101 is a complete rewrite. This book will have all new content and is on track to be one of my longest books. I think you will really like it if you are a beginner learning Python or someone who has been using Python but would like to improve to the next level.
I have put together some sample chapters for the 2nd edition of Python 101 which is coming out later this year. You can download the PDF version of these sample chapters here. Note that these chapters may have minor typos in them. Feel free to let me know if you find any bugs or errors.
If you are interested in getting a copy of the book, you can do so over on Kickstarter.
The second edition of my book, Python 101, has been successfully funded on Kickstarter. As is tradition, I have added a couple of stretch goals for adding more content to this already hefty book.
Here are the goals:
1) $5000 – Get 4 Bonus Chapters
These chapters would cover the following topics:
How to Create a GUI
How to Create Graphs
How to Work with Images in Python
2) $7500 – Add Chapter Review Questions
The additional chapters are pretty exciting to me as they are fun things to do with Python while also being useful. The assignment expression chapter is also something that is new in Python and may be of use to you soon.
Adding chapter review questions was something I have always wanted to do with Python 101. Hopefully you will find that idea interesting as well.
If you are interested in getting the book or supporting this site, you can head over to Kickstarter now. There are some really good deals for some of my other books there too!
I am excited to announce that my newest book, Python 101, 2nd Edition is launching on Kickstarter today!
Python 101 holds a special place in my heart as it was the very first book I ever wrote. Frankly, I don’t think I would have even written a book if it weren’t for the readers of this blog who encouraged me to do so.
The new edition of Python 101 will be an entirely new, rewritten from scratch, book. While I will be covering most of the same things as in the original, I have reorganized the book a lot and I am adding all new content. I have also removed old content that is no longer relevant.
I hope you will join me by backing the book and giving me feedback as I write it so that I can put together a really great learning resource for you!
Interesting in learning Python? Well you will be happy to know that I am running a Black Friday / Cyber Monday sale of my Python books. But I am starting the sale early so that you have plenty of time to decide if you’d like to buy one of my books. Check them out below!
Note that Python 101 is free. You can bump the amount to pay all the way down to $0 if you’d like a free copy.
Also note that all my books have free sample chapters so you can check those out before you purchase.
Creating GUI Applications with wxPython
Creating GUI Applications with wxPython is my latest book. In it you will learn how to create cross-platform desktop applications using wxPython. Use this link or click the image above to get a discount.
Jupyter Notebook 101
The Jupyter Notebook is a great teaching tool and it’s a fun way to use and learn Python and data science. I wrote a nice introductory book on the topic called Jupyter Notebook 101.
ReportLab – PDF Processing with Python
Creating and manipulating PDFs with Python is fun! In ReportLab – PDF Processing with Python you will learn how to create PDFs using the ReportLab package. You will also learn how to manipulate pre-existing PDFs using PyPDF2 and pdfrw as well as a few other handy PDF-related Python packages.
Can you tell us a little about yourself (hobbies, education, etc):
I was brought up in the US, earned a B.A. in Math and taught Math for 8 years in big and small schools. I always wanted to show students the real-world applications of the stuff they were learning, all of which turned out to be computer-related. I learned to program in my 30â€™s in Logo by going page-by-page through Samuel Papertâ€™s brilliant book Mindstorms. After that I taught all my math classes turtle programming. A student turned me on to Python and I never looked back. Away from the computer, I like to play guitar and watch documentaries. Continue reading PyDev of the Week: Peter Farrell→
The Portable Document Format (PDF) is a well-known format popularized by Adobe. It purports to create a document that should render the same across platforms.
Python has several libraries that you can use to work with PDFs:
ReportLab – Creating PDFs
PyPDF2 – Manipulating preexisting PDFs
pdfrw – Also for manipulating preexisting PDFs, but also works with ReportLab
PDFMiner – Extracts text from PDFs
There are several more Python PDF-related packages, but those four are probably the most well known. One common task of working with PDFs is the need for merging or concatenating multiple PDFs into one PDF. Another common task is taking a PDF and splitting out one or more of its pages into a new PDF.