What Do Developers Need to Learn from DropBox’s 4Million Lines of Python?


Python might be the world’s most widely used programming language, but developers know how challenging it can be to maintain a lengthy Python code. In spite of being the primary programming language of over 8 million developers, Python has limitations. These deterrent qualities of Python is the main reason why it is still far behind in the race of being used as an enterprise-level language.

Writing complex bases and maintaining even a few thousand lines of code in Python can be a nightmare for enterprises unless adequate measures are taken. There are many reasons for these limitations of Python, not the least of which are Python’s inbuilt dynamic nature of programming.

When writing large programs in Python, it becomes excessively difficult for developers to find out valid arguments to a function or the possible types of return values. It makes understanding and readability one of the biggest hassles for developers. Since a significant number of developers and testers are involved in a large scale project, it becomes an elementary quality for the code to be readable. And because large scale projects are not a result of one developer, there must be some standards adopted at the enterprise level which keep a check on the code.

What Makes Python Challenging?

Python has been in the news recently because of many reasons. Its valuable contribution to implementing machine learning models is undeniable. Apart from this, it is also quickly used for application development and data analytics. In spite of these multitudinous characteristics of Python, it was the talk of the town because of its shortcomings. The cloud-based software platform Salesforce recently replaced Python in its analytics platform with Google’s Go. While Google’s Go is relatively new to Python and designed for large scale implementation, it’s readability is what catches the attention.

Must Read: Can Nim be the Next Python?

Readability can also impact productivity severely in an organization. Since the lines of code only increase complexity in nature, it becomes challenging for developers to take cues from what’s happening at earlier stages in a program. This factor directly impacts productivity. Employees thus spend a massive amount of time understanding the code that could have been otherwise utilized in building new modules and classes.

Another one of the shortcomings of Python includes its dynamic nature. Unlike Google’s Go which is a statically types programming language, Python is more of a general-purpose language. It means that Python has design restrictions. While other languages explicitly ask the developer to define return types along with other parameters when writing a function, Python doesn’t. As a result, Python developers are familiar with more than a few errors that occur at the runtime. On the other hand, applications built-in Python require more rigorous testing.

DropBox’s Approach to Large Scale Development with Python

But, keeping these limitations aside, Python can be an excellent programming language for developers. Having said this, the cloud-based file hosting service Dropbox is a big fan of Python. At Dropbox, it is easy to find developers who use Python for both backend services and desktop client applications. Let’s take a look at how Python’s dynamic nature couldn’t stop Dropbox from writing 4 million lines of code

One of the benefits of using a statically typed programming language like Golang is that it reduces the chances of runtime errors and makes the code more readable. However, since Python is dynamically typed, there had to another way to achieve successful implementation of large scale projects. Dropbox used annotations for the task.

Hire Python developers to code right from the beginning helps define data types for different variables along with the respective types for function argument and return values. Although it requires some significant work from developers upfront, there are many benefits to it. For the starters, it can be using a static type checker for the code.

Dropbox is one of the few companies in the world today that has adopted type checking at such a large scale for its projects. A type checker called mypy was used that helped stop a class of bugs that would otherwise have been difficult for developers and testers to spot. Type checking is fundamental to a large scale code written in Python. While some developers enjoy Python’s dynamic typing, type checking prevents any errors from crawling into the program because of it.

A type checker like mypy runs checks before the developer implements the code. This practise helps in verifying various operations like whether the data being passed to and fro from various functions is of the correct type. Python’s version 3.5 was the first to support Type Hints that enabled developers to include annotations and be scrutinized by type checkers like mypy.

Highlighting the use of type checkers from its experience, Dropbox mentioned that annotating the code makes it much easier for the developer to understand it. As a result, it drives productivity when building an extensive scale application. Dropbox also regularly sent weekly reports to their teams. These mentioned a check on the factors that their annotations were covering along with suggestions to making them more valuable. Gradually strictness for the code was also increased, and it resulted in the following-

Easier Refactoring

A type checker would instantly provide references to the code that needed to be changed. This made refactoring much more comfortable and saved the time spent in analyzing deep stack traces.

Convenient Testing

Testing a broad scale application takes more than a few seconds, sometimes even minutes. But, mypy can quickly type-check millions of lines of code in a fraction of a second. For developers, it is a big win.

Also Read: Machine Learning Libraries in Python That Are Changing the World

Verified Documentation

A type checker enforces a standard style of annotations. This provides more precise and verified documentation since the type checker allows the developer to enter the type and checks it with its implementation in the code.


It’s been a long journey for Dropbox to test things and find the best solutions to Python’s underlying large-scale hassles. Along the way, the company has standardized more than a couple of things that have resulted in better coding practices and a more natural understanding of the code. These include a standardized ecosystem around type checking, IDE and editor support for type hints, multiple type checkers with different tradeoffs along with the library support. However, new developers might find type checking a lot more work than usual. But, with Dropbox’s experience, annotating and type checking might be the key to harnessing the benefits of Python.

You might like

We use cookies in order to give you the best possible experience on our website. By continuing to use this site, you agree to our use of cookies.