Simon Willison’s Weblog

Items tagged python in Sep

Filters: Month: Sep × python ×


Is it bad practice to have a variable that has the same name as a function?

Yes, it’s definitely not a good idea. In Python functions and variables share the same namespace, so if you create a variable with the same name as a function you won’t be able to call that function.

[... 93 words]

ijson. A SAX-style streaming JSON parser for Python, using ctypes to talk to the yajl C library. # 22nd September 2010, 9:59 pm

Python Logging 101. A really useful introduction to Python’s logging module by that module’s author, Vinay Sajip. # 29th September 2009, 6:40 pm

Django ponies: Proposals for Django 1.2

I’ve decided to step up my involvement in Django development in the run-up to Django 1.2, so I’m currently going through several years worth of accumulated pony requests figuring out which ones are worth advocating for. I’m also ensuring I have the code to back them up—my innocent AutoEscaping proposal a few years ago resulted in an enormous amount of work by Malcolm and I don’t think he’d appreciate a repeat performance.

[... 1674 words]

MySQL, Python and MacOS X 10.6 (Snow Leopard). I gave up on compiling things when I upgraded to Snow Leopard—I’m back to running Ubuntu in a VMWare instance, mounted over Samba so I can still use TextMate. # 25th September 2009, 10:14 pm

Diesel. Yet Another Asynchronous Python Comet Library, of interest because this is the first one I’ve seen that uses Python’s generator coroutines, taking advantage of the return value of the yield statement to feed messages in to a generator function. Currently only works on Python 2.6 on Linux due to a dependency on 2.6’s epoll support. # 23rd September 2009, 5:15 pm

Fabric factory. Promising looking continuous integration server written in Django, which uses Fabric scripts to define actions. # 21st September 2009, 6:35 pm

Tornado Web Server (via) An extremely exciting addition to the Python web landscape, Tornado is the open sourced version of FriendFeed’s custom web stack. It’s a non-blocking (epoll) Python web server designed for handling thousands of simultaneous connections, perfect for building Comet applications. The web framework is cosmetically similar to web.py or App Engine’s webapp but has decorators for writing asynchronous request handlers. The template language uses Django-style syntax but allows you to use full Python expressions. FriendFeed have benchmarked it handling 8,000 requests a second running as four load-balanced processes on a 4 core server. # 10th September 2009, 9:32 pm

Why Python Pickle is Insecure. Because pickle is essentially a stack-based interpreter, so you can put os.system on the stack and use it to execute arbitrary commands. # 9th September 2009, 11:04 pm

Debugging Django in Production Revisited. Eric Holscher expands his show-technical-errors-to-superusers middleware to only show them to users in the group named “Technical Errors”. # 7th September 2009, 5:21 am

svnpubsub.py (via) A Twisted/Python powered comet API for pushing out Subversion commits, built for Apache Foundation projects. # 6th September 2009, 9:50 pm

And so it goes, around again. Charles Miller on Java, pointing out that if you don’t have closures and first-class functions you end up having to add band-aid solutions and special case syntactic sugar. Python’s lack of multi-line lambdas leads to a similar (though less pronounced) effect. # 3rd September 2009, 9:46 am

Reia. The most common complaint I see about Erlang is the syntax. Reia is a Python-style scripting language (with a dash of Ruby) that runs on the Erlang virtual machine. Looks promising. # 25th September 2008, 6:12 pm

Decorator to limit request rates to individual views. Neat piece of code for public facing web APIs written in Django. Update: some smart criticisms in the comments. # 24th September 2008, 1:13 pm

bpgsql. Barry Pederson’s pure Python PostgreSQL client library now ships with a Django backend. # 23rd September 2008, 11:42 am

RestView—a class for creating a view that dispatches based on request.method (via) I finally got around to writing up a simple approach I’ve been using for REST-style view functions in Django that dispatch based on request.method. # 21st September 2008, 8:47 pm

backup_to_s3.py. I wrote Yet Another S3 backup script today. It’s a thin wrapper about boto that doesn’t do anything particularly impressive, but it fits my brain. # 21st September 2008, 6:51 pm

Django version 1.1 roadmap. Django 1.1 is due out in March, but the deadline for feature proposals is November the 7th. # 20th September 2008, 7:17 pm

Django’s release process. Django is moving to time-based releases, with minor releases (new features but no backwards incompatible changes) approximately every six months. # 20th September 2008, 7:16 pm

DjangoCon and learning from Zope 2. Mark Ramm presented probably the most thought-provoking talk at DjangoCon. He’s started writing it up as a series of posts. # 17th September 2008, 11:25 pm

YouTube Playlist: DjangoCon 2008 Sessions. YouTube’s tag and search indexes appear to lag behind the main site by quite a while; this appears to be the definitive index page for videos of talks at DjangoCon. # 16th September 2008, 4:50 am

YouTube: djangocon tag. Google have started posting videos of presentations at DjangoCon on YouTube. # 16th September 2008, 2:43 am

DjangoCon and PyCon UK

September is a big month for conferences. DjangoCon was a weekend ago in Mountain View (forcing me to miss both d.Construct and BarCamp Brighton), PyCon UK was this weekend in Birmingham, I’m writing this from @media Ajax and BarCamp London 5 is coming up over another weekend at the end of this month. As always, I’ve been posting details of upcoming talks and notes and materials from previous ones on my talks page.

[... 446 words]

Kevin Teague explains the Python packaging ecosystem. The distinction between setuptools, PyPI, distutils, eggs, easy_install, pkg_resources and zc.buildout used to make my head spin. Kevin Teague’s outstanding explanation made it all make sense. # 15th September 2008, 2:06 pm

django-batchadmin (via) Seriously classy reusable Django app that adds batch editing (multiple delete by default, with hooks to add your own custom batch actions) to the Django admin changelist screen, using best practice techniques of sub-classing ModelAdmin and hence requiring no patches to Django core itself. # 15th September 2008, 10:46 am

Using Python and Stompserver to Get Started With Message Queues. An eminently practical guide to this year’s Hot New Thing (for web developers at least) from Gareth Rushgrove. # 14th September 2008, 11:39 pm

Django snippets: Orderable inlines using drag and drop with jQuery UI. Code example from my PyCon tutorial on customising the Django admin interface. # 13th September 2008, 12:19 pm

The TimeToLead.eu technical stack: Django and Flex. Nice case study of a site using Django’s i18n support along with django-rosetta. # 11th September 2008, 8:33 pm

Prototype based programming in python. Neat implementation of JavaScript-style prototype inheritance in Python. # 11th September 2008, 5:50 pm