Posts tagged: PYTHON

A use case for Python assignment expressions

Python 3.8 (2019) added “assignment expressions”, aka the “walrus operator”.

I generally like things that make Python more expression-oriented, like list comprehensions, but I’m ambivalent about these. It’s pretty easy to impair readability by using them overzealously. Is saving one line of code worth making it harder to notice that an assignment is happening?

However, I’ve found a use case I like a lot. I use them in the Django Python shell when doing exploratory ORM queries.

Good Python Interview Questions

When we were growing our team of Python devs at CMG, I was involved in a lot of interviews. I really enjoyed it, meeting and hiring interesting and talented engineers.

I’m not a big fan of quizzing people on technical minutiae in interviews. I do think that asking some questions about technical likes and dislikes can be very illuminating though.

For example, “What’s your favorite standard library module?” (My favorite answers are itertools or functools, but anything that shows they have hands-on appreciation for the depth of the standard library is good.)

Does Python scale?

(This is another thing I found myself writing on Quora and wanted to keep. The question was “Does Python have any scalability limitations?”)

“Scalability” is a term people like to throw around, but the less specific you are as to what you mean by it, the less substantial the answers will be. It is not a simple linear measure on which languages can be given some numerical score.

Languages and their implementations do have certain inherent performance characteristics, but in order to understand their relevance to your needs you have to get specific about your needs.

Booktools

A little-known bit of trivia about our book, Python Web Development with Django: we wrote the manuscript in Markdown.

I think it was my idea. One of the major motivations for using a text-based format – versus the unfortunate de facto standard, Microsoft Word – was integration with good developer tools and workflow.

Our manuscript and all our project code was in a Subversion repo, so each author always had the latest updates. HTML generated from the Markdown files was great for generating nice printed/printable output too.

Making your way from PHP to Python and Django

“I’m a PHP programmer and I want to check out this Django thing. What should I do?”

I’ve been seeing this kind of question pop up more and more, and I have a few answers.

First-hand experience as well as many conversations with developers online have led me to the same conclusion: the curious person behind such a question should be encouraged and assisted. (I’ll call that person “Pat” for the rest of the post, for convenience and conscientious gender-neutrality.)