If you’re like me, you missed PyCon North America 2014 this year. It happened last weekend. While the main conference days are over, the code sprints are still running. Anyway, for those of you who missed PyCon, they have released a bunch of videos on pyvideo! Every year, they seem to get the videos out faster than the last. I think that’s pretty awesome myself. I’m looking forward to watching a few of these so I can see what I missed.
Entries tagged with “Python”.
Mon 14 Apr 2014
Mon 31 Mar 2014
I just wanted to drop a quick note that the Python 101 book is now available for Pre-order here. Currently you will receive the draft versions of the book as they become available. Right now, Parts I and II have been released which amounts to approx. 115 pages of content.
You can read more about the book below: (more…)
Thu 27 Mar 2014
When you’re first starting out as a Python programmer, you don’t think about how you might need to install an external package or module. But when that need appears, you’ll want to know how to in a hurry! Python packages can be found all over the internet. Most of the popular ones can be found on the Python Package Index (PyPI). You will also find a lot of Python packages on github, bitbucket, and Google code. In this article, we will be covering the following methods of installing Python packages:
- Install from source
- Other ways to install packages
Wed 26 Mar 2014
The lxml.objectify sub-package is extremely handy for parsing and creating XML. In this article, we will show how to create XML using the lxml package. We’ll start with some simple XML and then try to replicate it. Let’s get started! (more…)
Mon 24 Mar 2014
There are a couple of ways to create Microsoft Excel spreadsheets with Python. You can use PyWin32′s win32com.client method, which was discussed in an old article a number of years ago or you could use the xlwt package. We’ll be looking at the latter in this article. You will learn how to create an Excel spreadsheet with multiple worksheets and how to create styled cells. Let’s get started! (more…)
Fri 21 Mar 2014
The Python 101 book campaign finished today. I am now well funded to create the book and get all the artwork done. I think I may try to get additional illustrations too. While we didn’t hit the next stretch goal, I plan to go ahead and work on screencasts anyway. As I mentioned previously, I most likely won’t start on those until after I’ve finished writing the book. I have received lots of positive comments about the book so far and I hope to put out a product that you will find useful.
I will be sending out Part I as soon as I can after Kickstarter transfers the funds. You will receive a survey asking for your email address. I will probably be sending a survey out to those who bought t-shirts and such too.
Thanks a lot for all your support. I am very grateful.
Thu 20 Mar 2014
Code profiling is an attempt to find bottlenecks in your code. Profiling is supposed to find what parts of your code take the longest. Once you know that, then you can look at those pieces of your code and try to find ways to optimize it. Python comes with three profilers built in: cProfile, profile and hotshot. According to the Python documentation, hotshot “no longer maintained and may be dropped in a future version of Python”. The profile module is a pure Python module, but adds a lot of overhead to profiled programs. Thus we will be focusing on cProfile, which has an interface that mimics the profile module. (more…)
Wed 19 Mar 2014
Python comes with its own debugger module that is named pdb. This module provides an interactive source code debugger for your Python programs. You can set breakpoints, step through your code, inspect stack frames and more. We will look at the following aspects of the module:
- How to start the debugger
- Stepping through your code
- Setting breakpoints
Let’s start by creating a quick piece of code to attempt debugging with. (more…)
Wed 19 Mar 2014
There are under 2 days left in the book campaign! I think that’s pretty exciting. I hope you do too!
I’ve been busy writing the new Part 3 lately. I only have two more chapters to go before it’s done. My hope is that Part 3 will be done by the end of the week.
I have also come up with a fun little script that can put my book together for me. Today it dawned on me that this little program would be a good illustration for my readers about how to tackle a project and break it into more manageable pieces. So I’ll be adding a chapter or two somewhere in the book about that as some of my backers have already mentioned that they would like to know how to do this sort of thing.
Thanks for your support!
Mon 17 Mar 2014
Python includes a couple of modules for testing in its standard library: doctest and unittest. We will be looking at doctest in this article. The doctest module will search for pieces of text in your code that resemble interactive Python sessions. It will then execute those sessions to verify that they work exactly as written. This means that if you wrote an example in a docstring that showed the output with a trailing space or tab, then the actual output of the function has to have that trailing whitespace too. Most of the time, the docstring is where you will want to put your tests. The following aspects of doctest will be covered:
- How to run doctest from the terminal
- How to use doctest inside a module
- How to run a doctest from a separate file
Let’s get started! (more…)