Simon Willison’s Weblog

Subscribe
Atom feed for python

1,070 items tagged “python”

The Python programming language.

2013

What is the best way to deploy Django?

These days a popular and reliable method is to run gunicorn behind nginx. This tutorial includes notes on using upstart for process management which is handy if you are on Ubuntu: http://lincolnloop.com/django-be...

[... 47 words]

Do Flask and Django have a GUI interface like web2py?

No. The web2py GUI is something of an oddity in the Python world.

[... 65 words]

Which should I learn: Python or PHP?

Python will teach you more about programming than PHP—and you’ll be able to learn PHP easily if you learn Python first.

[... 36 words]

What are some hidden features of Python?

Generators and Iterators are pretty amazing. These two tutorials will really open your eyes as to how powerful they can be:

[... 63 words]

How do I learn Python fast?

Learn how to use the Python interactive prompt and start solving problems with it. The official Python tutorial is an excellent place to start: http://docs.python.org/2/tutorial/

[... 38 words]

2012

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: http://reddit.com/r/python

[... 21 words]

What are some apps, problems you would suggest to solve a new python developer?

The best way to learn python in my opinion is using the interactive prompt. Install ipython (a massive improvement on the standard python shell) and use it to interactively solve some simple tasks—things like downloading a CSV file from the web using the urllib library, parsing it with the csv module, then poking around in the data using python list comprehensions and saving some of the results out to a JSON file.

[... 95 words]

What is the scope, as a career, for a Python developer?

Don’t be an “X developer”. You’re selling yourself short if you define yourself by the technology you most frequently use.

[... 169 words]

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]

What are the best resources for learning regular expressions?

The O’Reilly book on Regular Expressions is absolutely superb. It will help you build a much deeper understanding if how they actually work than any online tutorial I’ve seen.

[... 62 words]

What web programming framework best supports ’drag and drop’ actions?  Please give examples of sites and/or plug-ins that support the interaction.

Drag and drop is a client-side thing—it has nothing to do with the server-side technology being used.

[... 72 words]

Python Django load MySQL database from csv files performance issue?

Don’t use the Django ORM for bulk imports—the performance overhead is pretty small for regular web page stuff, but it adds up if you are running millions of inserts.

[... 63 words]

How can I look up Django functions?

You can use the ./manage.py shell command to get a shell which will import any Django modules (or any of your own code) without complaining about the location of the settings.py module. Install IPython first to get a much more useful interactive shell when you run that command.

[... 190 words]

If python dictionaries are inherently orderless, why were they given the name if a real dictionary is sorted by letter?

The metaphor here is that paper dictionaries make it easy to look stuff up by letter or word—just like Python dictionaries make looking something up by key an instant operation.

[... 114 words]

How can I install Django in a server without shell access?

I don’t think you can.

[... 42 words]

Why is the Zen of Python obfuscated in the “this” module?

I imagine the reason is very simple: Because it’s fun!

[... 27 words]

Do Python programmers have a tendency to write their own software instead of contributing? Why?

I think you’ll find that PROGRAMMERS have a tendency to develop their own thing rather than contributing to an existing project. It’s even got its own TLA: NIH (Not Invented Here).

[... 94 words]

Companies like Wipro (Indian company), Infosys (company), Capgemini uses Java, .Net for developing web and desktop application. But I haven’t seen any consulting company of their size using Python.  Is there any python consulting company of size 1000...

ThoughtWorks do a lot of projects in Ruby and some in Python. Their website says they now have 1700 people.

[... 65 words]

Are there any good Django video tutorials?

ShowMeDo has 55 video screencasts covering all sorts of aspects of Django development: http://showmedo.com/videotutoria...

[... 56 words]

Is it true that Ruby is more deployment friendly than Python?

He’s incorrect (or at least out of date). Most professional python programmers that I know of use virtualenv, which makes it easy for deployed Python code to live in its own environment with its own set of modules installed separately from the core system packages.

[... 106 words]

Is Django on its way out?

Not as far as I can tell—but then like many (most?) other Django users I’m too busy using it to build things to worry too much about whether or not it’s fashionable.

[... 46 words]

Is there a framework that allows me to collect input from individual users, and then charge for the aggregate and analysis of that data?

No—your needs are extremely specific. You’re going to have to build this yourself.

[... 95 words]

2011

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: http://lanyrd.com/topics/python/...

[... 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]

Is South the best tool to use when doing database migrations in Django?

Yes. And I say that as an author of another Django migrations tool (dmigrations) which offered a small subset of South’s current functionality.

[... 42 words]

The First Few Weeks—ep.io. Another take on managed Python Django/WSGI hosting, from Andrew Godwin and Ben Firshman.

# 13th January 2011, 4:25 am / django, hosting, python, wsgi, recovered, andrew-godwin, ben-firshman