I’ve been a Python developer since the late 1990s and came to the OpenStack project from that long background within the rest of the community. Thierry Carrez is on the staff of the OpenStack Foundation and the chair of the OpenStack Technical Committee. He came to Python through OpenStack’s adoption of the language.
At EuroPython 2016, we delivered a presentation titled “How OpenStack Makes Python Better, and Vice-Versa”, discussing the history of the decision to use Python, our perspectives on how the two communities benefit each other, and how we can improve the relationship. The recording of the presentation, and the slides, are below.
The enum module defines an enumeration type with iteration and comparison capabilities. It can be used to create well-defined symbols for values, instead of using literal integer or strings.
Read more…
This post is part of the Python Module of the Week series for Python 3. See PyMOTW.com for more articles from the series.
What’s new in 2.2.0? Use https with pypi.python.org package name checker (contributed by John-Scott Atlakson) Removed unnecessary shebang lines from non-script files (contributed by Avram Lubkin) Re-enable the PyEnchant dependency (contributed by Julian Berman)
Using threads allows a program to run multiple operations concurrently in the same process space.
Read more…
This post is part of the Python Module of the Week series for Python 3. See PyMOTW.com for more articles from the series.
The textwrap module can be used to format text for output in situations where pretty-printing is desired. It offers programmatic functionality similar to the paragraph wrapping or filling features found in many text editors and word processors.
Read more…
This post is part of the Python Module of the Week series for Python 3. See PyMOTW.com for more articles from the series.
I’m working on updating my book, and besides actually writing the content one of the things I have to do is generate new LaTeX files to deliver to the publisher. I’ve written about my toolchain elsewhere, so I won’t repeat all of that information here. The short version is that I use Paver to drive Sphinx to convert reStructuredText input files to HTML for the website, LaTeX for the compositor at Pearson, and PDF for reviewers. Since the updated version covers Python 3, and one of the key benefits of Python 3 is better Unicode support, I want to include some characters outside of the normal ASCII set in my examples.
When you ask Sphinx’s latex builder to generate LaTeX output the result is a directory with a *.tex file containing your content and some other files with all of the parts you need to convert that LaTeX to other formats, including a Makefile with instructions for building PDF and DVI. By default that Makefile uses pdflatex to convert the *.tex output files it writes to PDF. My article for the random module includes an example of shuffling a card deck. The Python 2 version used letters to represent the card suits, but for Python 3 I switched to using Unicode symbols like what would appear on the cards. Making that work for HTML was easy, but the PDF output proved trickier.
The shlex module implements a class for parsing simple shell-like syntaxes. It can be used for writing a domain-specific language, or for parsing quoted strings (a task that is more complex than it seems on the surface).
Read more…
This post is part of the Python Module of the Week series for Python 3. See PyMOTW.com for more articles from the series.
What’s new in 1.13.0? provide a way to override the pdf generating command to support tools like xelatex instead of pdflatex for better unicode support
What’s new in 1.12.0? be explicit about how to lex the literal output to avoid issues with default language assumptions for inline literal blocks in Sphinx 1.4
pdb implements an interactive debugging environment for Python programs. It includes features to pause a program, look at the values of variables, and watch program execution step-by-step, so you can understand what the program actually does and find bugs in the logic.
Read more…
This post is part of the Python Module of the Week series for Python 3. See PyMOTW.com for more articles from the series.