I had some great feedback about the PyMOTW series from several of you at PyCon this weekend. Unfortunately, when I put you on the spot, no one had suggestions for what to write about next. I’ve been going through the library more or less randomly, and in the absence of a better idea I can continue with that plan. On the other hand, if there’s a topic that you would really like more details on, let me know and I’ll try to bump it up in the queue.
The datetime module includes functions and classes for doing date parsing, formatting, and arithmetic. Time values are represented with the time class. Times have attributes for hour, minute, second, and microsecond. They also, optionally, include time zone information. The arguments to initialize a time instance are optional, but the default of `` is unlikely to be what you want.
Read more at pymotw.com: datetime
The time module exposes C library functions for manipulating dates and times. Since it is tied to the underlying C implementation, some details (such as the start of the epoch and maximum date value supported) are platform-specific.
Read more at pymotw.com: time
The EasyDialogs module includes classes and functions for working with simple message and prompt dialogs, as well as stock dialogs for querying the user for file or directory names. The dialogs use the Carbon API.
Read more at pymotw.com: EasyDialogs
Automated testing is an important part of Agile development methodologies, and the practice is seeing increasing adoption even in environments where other Agile tools are not used. This article discusses testing techniques for you to use with the open source tool Proctor. By using Proctor, you will not only manage your automated test suite more effectively, but you will also obtain better results in the process.
What is Proctor? Proctor is a tool for running automated tests in Python source code.
Old-school developers remember lint, the static code analysis tool for C programs. There are several similar programs available for Python, and they can all help you clean up your act.
This month we continue examining Python development tools you have told me you can’t live without. A fair number of you have mentioned that you use a static analysis tool such as PyChecker, pylint, or PyFlakes. I have to admit, I was a bit skeptical of how useful any of them would be with Python.
The imp module includes functions that expose part of the underlying implementation of Python’s import mechanism for loading code in packages and modules. It is one access point to importing modules dynamically, and useful in some cases where you don’t know the name of the module you need to import when you write your code (e.g., for plugins or extensions to an application).
Read more at pymotw.com: imp
The February issue of Python Magazine is available for download now.
This month’s cover story by Chad Cooper is Mapping point locations with Python and Microsoft Live Search Maps. It’s all about visualizing your database of points on a map using their web service.
Arkadiusz Wahlig’s piece, Extending Skype using Python tells you the basics you need to write a Skype bot to add features to the popular chat and VOIP client.
The pkgutil module provides a single function, extend_path(), that is used to modify the search path for modules in a given package to include other directories in sys.path. This is very useful for overriding installed versions of packages with development versions, or for combining OS-specific and shared modules into a single package namespace.
Read more at pymotw.com: pkgutil
Based on recommendations via comments on an earlier post, my March column is a survey of a few different “lint” programs for Python (it looks like I’ll stick to PyChecker, pylint, and PyFlakes for now). I need some sample code to run through all 3 programs so I can compare the output reports. I have a few ideas for common “mistakes” to include, but I’m looking for other suggestions.
So, what kinds of things are these tools good at finding, and where do they need more work?