How to uninstall a package installed with pip install –user

Having tested this using Python 3.5 and pip 7.1.2 on Linux, the situation appears to be this: pip install –user somepackage installs to $HOME/.local, and uninstalling it does work using pip uninstall somepackage. This is true whether or not somepackage is also installed system-wide at the same time. If the package is installed at both … Read more

Why is ‘x’ in (‘x’,) faster than ‘x’ == ‘x’?

As I mentioned to David Wolever, there’s more to this than meets the eye; both methods dispatch to is; you can prove this by doing min(Timer(“x == x”, setup=”x = ‘a’ * 1000000″).repeat(10, 10000)) #>>> 0.00045456900261342525 min(Timer(“x == y”, setup=”x = ‘a’ * 1000000; y = ‘a’ * 1000000″).repeat(10, 10000)) #>>> 0.5256857610074803 The first can … Read more

Django MEDIA_URL and MEDIA_ROOT

UPDATE for Django >= 1.7 Per Django 2.1 documentation: Serving files uploaded by a user during development from django.conf import settings from django.conf.urls.static import static urlpatterns = patterns(”, # … the rest of your URLconf goes here … ) + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) You no longer need if settings.DEBUG as Django will handle ensuring this is … Read more

How does asyncio actually work?

How does asyncio work? Before answering this question we need to understand a few base terms, skip these if you already know any of them. Generators Generators are objects that allow us to suspend the execution of a python function. User curated generators are implement using the keyword yield. By creating a normal function containing … Read more