Simon Willison’s Weblog

Items tagged python in Dec

Filters: Month: Dec × python ×

benfred/py-spy (via) A Python port of Julia Evans’ rbspy profiler, which she describes as “probably better” than the original. I just tried it out and it’s really impressive: it’s written in Rust but has precompiled binaries so you can just run “pip install py-spy” to install it. Shows live output in the terminal while your program is running and also includes the option to generate neat SVG flame graphs. # 29th December 2018, 5:18 am

PEP 8016 -- The Steering Council Model (via) The votes are in and Python has a new governance model, partly inspired by the model used by the Django Software Foundation. A core elected council of five people (with a maximum of two employees from any individual company) will oversee the project. # 17th December 2018, 4:02 pm

Pampy: Pattern Matching for Python (via) Ingenious implementation of Erlang/Rust style pattern matching in just 150 lines of extremely cleanly designed and well-tested Python. # 17th December 2018, 7:14 am

Let your code type-hint itself: introducing open source MonkeyType. Instagram have open sourced their tool for automatically adding type annotations to your Python 3 code via runtime tracing. By default it logs the types it sees to a SQLite database, which means you can browse them with Datasette! # 15th December 2017, 2:22 am

Python 3 Readiness (via) 345 of the 360 most popular Python packages are now compatible with Python 3. I’d love to see a version of this graph over time. # 2nd December 2017, 11:13 pm

What are some good resources to learn how to cleanse data using Python? “Text Processing in Python” is a free online book that covers a bunch of useful topics related to data cleanup. It’s over 10 years old now but is still mostly relevant—the chapter on regular expressions is particularly good.

[... 61 words]

What are some useful techniques and tricks using list comprehension?

List comprehensions are neat, but generators are even neater (and if you understand tricks with generators you’ll be able to use list comprehensions more effectively as well). Generator Tricks for Systems Programmers by David Beazley will blow you mind—it’s full of useful real-world examples as well. Read that, then check out his follow-up tutorial A Curious Course on Coroutines and Concurrency.

[... 81 words]

How can some really large services (like Dropbox) afford to use Python as a primary language, if it’s one to two orders of magnitude slower than other, compiled languages?

Because raw language speed often doesn’t matter that much. In the case if Dropbox the client software spends most of its time waiting for bits to load from the network or from disk. Most large websites spend their time waiting for the database. You can’t speed up network or disk performance by using a faster language.

[... 91 words]

Which social news websites for Python are out there?

There’s a Python subreddit:

[... 21 words]

What are the most practical beneficials for Python, comparing to Java?

For me, the single most productive advantage of Python is the ability to work with it interactively in a REPL—I use ipython but Python also ships with an interactive mode out of the box.

[... 176 words]

Is it better to do Python development on an SSD, or on a mechanical disk?

SSDs are faster than regular drives for every application—Python is no different. That said, unless the Python code you are developing does a huge amount of disk IO you probably won’t notice the difference.

[... 57 words]

What is a good video series on learning Python?

It probably won’t teach you the basics, but we’ve collected 190 videos from conference talks about Python here:

[... 35 words]

Twitter API: What is the best data storage mechanism and client library for analysing tweets using Python?

It depends on how much data you intend to collect, and how you intend to then share that data.

[... 182 words]

HotQueue. A super-simple Python work queue using Redis. The API is neat, and makes clever use of generators for blocking consumption of queue items. # 22nd December 2010, 11:51 am

Web Sockets in Tornado. Bret Taylor has a simple class making it trivial to experiment with the Web Sockets protocol (now shipping in Chrome) using the scalable Tornado application server. He also raises the million dollar question: what will existing load balancers and proxies make of the new protocol? # 31st December 2009, 11:54 am

Socket Benchmark of Asynchronous Servers in Python. A comparison of eight different asynchronous networking frameworks in Python. Tornado comes out on top in most of the benchmarks, but the post is most interesting for the direct comparison of simple code examples for each of the frameworks. # 22nd December 2009, 10:34 pm

Django | Multiple Databases. Russell just checked in the final patch developed from Alex Gaynor’s Summer of Code project to add multiple database support to Django. I’d link to the 21,000 line changeset but it crashed our Trac, so here’s the documentation instead. # 22nd December 2009, 5:22 pm

Crowdsourced document analysis and MP expenses

As you may have heard, the UK government released a fresh batch of MP expenses documents a week ago on Thursday. I spent that week working with a small team at Guardian HQ to prepare for the release. Here’s what we built:

[... 2081 words]

Django-Jython 1.1.0 released. Django on Jython matches its minor version numbers to Django, so this new release is compatible with Django 1.1. # 16th December 2009, 10:42 pm

Guardian iPhone app. Released today, ad-free, £2.39 for the application, has an excellent offline mode. I helped build the backend web service, which is a Django app running on EC2. # 14th December 2009, 1:29 pm

Fixing Django Management Commands. Zachary Voase proposes dramatically improving Django’s management command API for Django 1.3. I’m in favour—management commands are one of the only APIs in Django that I have to look up every single time I use. My optfunc library was written partially with management commands in mind—Zachary favours the argparse library. # 9th December 2009, 8:41 am

Python’s Moratorium—Let’s think about this. Jesse Noller explains the thinking behind the Python Language Moratorium (no new language features until Python 3.3) in great detail. It’s principally about allowing both end users and alternative implementations to catch up. The standard library will continue to evolve as normal. # 5th December 2009, 5:33 pm

What’s coming in Django 1.2 (presentation notes). I wrote up some background notes for the talk on Django 1.2 I gave at DJUGL last week. # 5th December 2009, 5:10 pm

Namespaces. Python’s approach to imports is possibly my favourite feature of the language. I love being able to scan up to the top of a file in my text editor and see exactly where every symbol comes from, no IDE required. # 2nd December 2009, 9:31 am

Represent. Andrei Scheinkman and Derek Willis describe how they built the NYTimes Represent feature using GeoDjango and PostGIS. # 29th December 2008, 10:10 pm

pygooglechart. I tried a bunch of Python wrappers for Google Charts and liked this one best. # 22nd December 2008, 11:43 am

Represent and GeoDjango. The NYTimes new Represent application is built on GeoDjango. # 20th December 2008, 9:07 pm

How to install lxml python module on mac os 10.5 (leopard). Instructions that work! Finally, I can find out what all the fuss is about. # 15th December 2008, 12:05 am

On packaging. James Bennett discusses the problems with setuptools (and ruby gems), and recommends Ian Bicking’s pip as a setuptools replacement. # 14th December 2008, 4:57 pm