We've Launched "The Suddenly Remote Playbook,"
A Comprehensive Guide for Working Remotely
The Suddenly Remote Playbook
Read Now

Python

Showing 37-43 of 43 results
EngineeringIcon ChevronWeb front-end

Django, Flask, and Redis Tutorial: Web Application Session Management Between Python Frameworks

by Denis Kyorov

I love and use Django in lots of my personal and client projects, mostly for those involving relational databases and more classical web applications. However, by design, Django is very tightly coupled with its ORM, Template Engine System, and Settings object. Plus, it's not a new project: it carries a lot of baggage from the past to remain backwards compatible. In a few of my client projects, we've chosen to give up on Django and use a micro framework like Flask, typically when the client wants to do some interesting stuff with the framework. At the same time, we often need user registration, login, and more, all of which is easily handled with Django. The question emerged: is Django an all-or-nothing deal? Should we drop it completely from the project, or is there a way to combine some it with the flexibility of other frameworks?

9 minute readContinue Reading
EngineeringIcon ChevronTechnology

Python Class Attributes: An Overly Thorough Guide

by Charles Marsh

In a recent phone screen, I decided to use a class attribute in my implementation of a certain Python API. My interviewer challenged me, questioning whether my code was syntactically valid, when it was executed, etc. In fact, I wasn't sure of the answers myself. So I did some digging. Python class attributes. No one really knows when (or how) to use 'em. In this guide, I walk through common pitfalls and conclude with a list of valid use-cases that could save you time, energy, and lines of code.

11 minute readContinue Reading
EngineeringIcon ChevronTechnology

Computational Geometry in Python: From Theory to Application

by Charles Marsh

When people think computational geometry, in my experience, they typically think one of two things: 1. Wow, that sounds complicated. 2. Oh yeah, convex hull. In this post, I'd like to shed some light on computational geometry, starting with a brief overview of the subject before moving into some practical advice based on my own experiences in computational geometric programming with Python.

15 minute readContinue Reading
EngineeringIcon ChevronTechnology

An Introduction to Mocking in Python

by Naftuli Kay

More often than not, the software we write directly interacts with what we would label as "dirty" services. In layman's terms: services that are crucial to our application, but whose interactions have intended but undesired side-effects—that is, undesired in the context of an autonomous test run. For example: perhaps we're writing a social app and want to test out our new 'Post to Facebook feature', but don't want to _actually_ post to Facebook every time we run our test suite. The Python `unittest` library includes a subpackage named `unittest.mock`—or if you declare it as a dependency, simply `mock`—which provides extremely powerful and useful means by which to mock and stub out these undesired side-effects.

9 minute readContinue Reading
EngineeringIcon ChevronTechnology

Why Are There So Many Pythons? A Python Implementation Comparison

by Charles Marsh

Python is amazing. Surprisingly, that's a fairly ambiguous statement. What do I mean by 'Python'? Do I mean Python the abstract interface? Do I mean CPython, the common Python implementation? Or do I mean something else entirely? Maybe I'm obliquely referring to Jython, or IronPython, or PyPy. Or maybe I've really gone off the deep end and I'm talking about RPython or RubyPython (which are very, very different things). While the technologies mentioned above are commonly-named and commonly-referenced, some of them serve completely different purposes (or at least operate in completely different ways). In this post, I'll start from scratch and move through the various Python implementations, concluding with a thorough introduction to PyPy, which I believe is the future of the language.

10 minute readContinue Reading
EngineeringIcon ChevronMobile

Control Your Laptop with an Android Phone using Python, Twisted, and Django

by Martin Chikilian

It’s always fun to put your programming skills on display. A while back, I figured it’d be cool to try and control my laptop via my Android mobile device. Think about it: being able to play and pause music, start and stop programming jobs or downloads, etc., all by sending messages from your phone. Neat, huh?

6 minute readContinue Reading
EngineeringIcon ChevronData Science and Databases

How I Made Porn 20x More Efficient with Python Video Streaming

by Gergely Kalman

Porn is a big industry. There aren’t many sites on the Internet that can rival the traffic of its biggest players. And juggling this immense traffic is tough. To make things even harder, much of the content served from porn sites is made up of low latency live streams rather than simple static video content. But for all of the challenges involved, rarely have I read about the developers who take them on. So I decided to write about my own experience on the job.

7 minute readContinue Reading

Join the Toptal® community.