Toptal is a marketplace for top Python developers, engineers, programmers, coders, specialists, architects, and consultants. Top companies and startups choose Toptal Python freelancers for their mission-critical software projects.
United StatesFreelance Python Developer at Toptal Since October 3, 2017
Chris has years of experience in developing API services. He's most comfortable using the aiohttp package, SQLAlchemy (Alembic), and the PostgreSQL stack, but he's also familiar with Flask, MongoDB, Redis, and more. He's been a part of the back-end team at Indico Data Solutions—a machine learning API and tools provider—developing back-end services handling big data processing and analysis. Chris also has excellent skills with AWS, GCE, and Azure clouds.
United KingdomFreelance Python Developer at Toptal Since June 4, 2019
Max is a data science and machine learning expert specializing in deep learning and natural language processing. He helped build one of Germany's most highly funded fintechs and successfully founded his own AI company in London. Max's work has resulted in the publication of a scientific paper, increased marketing accuracy through advanced analytics, and built reliable models for the prediction of sports events and customer behavior.
United StatesFreelance Python Developer at Toptal Since June 13, 2019
Viacheslav has seven years of experience in data science and software engineering. He is passionate about the insights gained from raw data and enjoys converting them to create exceptional business value. Viacheslav's primary expertise is Python, with production experience in Java and C++. To solve data-heavy projects, he has applied advanced machine learning techniques, such as computer vision, NLP, product recommendation systems, networking data, and classical data science.
NorwayFreelance Python Developer at Toptal Since June 14, 2019
Branislav is a highly-skilled, enthusiastic developer. He is hard-working, possesses extensive problem-solving skills, and loves implementing a general algorithmic approach. A team player with a can-do attitude, Branislav is interested in eCommerce and PHP in further connection with other services. He’s worked the full development lifecycle from identifying the client’s real needs to designing the systems architecture as well as implementation.
United StatesFreelance Python Developer at Toptal Since September 12, 2018
Throughout his career, Ryan has consistently worked with startups and small software shops where each milestone was make-it or break-it. He loves infrastructure as code managed with Terraform in AWS. Ryan found his niche writing DevOps tooling in Go and Bash and contributes to the open-source community regularly. Ryan is also an expert working with Docker to deploy and maintain Kubernetes systems. Ryan excels at working as a technical leader or alongside a team, depending on the project's needs.
IsraelFreelance Python Developer at Toptal Since December 10, 2019
Yoni fell in love with programming at the age of 11, and now he doesn't know how to stop. He started his professional career with C++ and has since transitioned his focus to more user-facing software. For the past decade, he was hands-on with all parts of the stack at high-profile startups. He's currently looking to help create exceptional iOS/macOS apps, with experience shipping sophisticated iOS apps since before the App Store existed.
SingaporeFreelance Python Developer at Toptal Since December 10, 2019
Avenash has 15+ years of experience in all areas of the software development lifecycle, with a proven track record in developing web applications, back-end services, and external APIs. He is an engineering leader and mentor with experience in building and scaling high-performance teams in companies at various stages, guiding software architecture, design, and implementation, and managing stakeholders across executives, product, strategy, operations, and business development functions.
United Arab EmiratesFreelance Python Developer at Toptal Since December 6, 2019
Luigi is a seasoned cloud and leadership specialist with over two decades of professional experience in a variety of environments. He is passionate about technology and value-driven projects, and he is highly adaptable. Luigi has been part of significant industry transformation waves directly from some of the leaders driving the digital era.
MaltaFreelance Python Developer at Toptal Since December 4, 2019
Stephen is passionate about open source technology with a focus on building code-defined test-driven developer tooling in AWS. He began his career as a network engineer and moved up the stack working on infrastructure, hardware, storage, provisioning, system administration, and automation. Stephen is an advocate of containers, Cloud, observability, self-service platforms, and solid security.
CanadaFreelance Python Developer at Toptal Since December 4, 2019
Julien, a skilled senior full-stack developer, boasts over seven years of expertise. His portfolio includes diverse projects, from small startups to large-scale apps with millions of daily users. Excelling in feature development, debugging, and mentorship, he leads clients to success. Julien's thirst for knowledge drives him to explore payments, UI/UX, design systems, unit testing, blockchain, ML/AI, web3, analytics, marketing, eCommerce, and more.
RomaniaFreelance Python Developer at Toptal Since December 4, 2019
So you’ve found what appears to be a strong Python developer. How do you determine if he or she is, in fact, in the top 1% of candidates? Here are proven, effective techniques and questions for finding true masters of the language.
... allows corporations to quickly assemble teams that have the right skills for specific projects.
Despite accelerating demand for coders, Toptal prides itself on almost Ivy League-level vetting.
Creating an app for the game
Building a cross-platform app to be used worldwide
Leading a digital transformation
Drilling into real-time data creates an industry game changer
What our clients think
Clients Rate Toptal Python Developers4.4 / 5.0on average across 2,252 reviews as of Dec 2, 2023
Tripcents wouldn't exist without Toptal. Toptal Projects enabled us to rapidly develop our foundation with a product manager, lead developer, and senior designer. In just over 60 days we went from concept to Alpha. The speed, knowledge, expertise, and flexibility is second to none. The Toptal team were as part of tripcents as any in-house team member of tripcents. They contributed and took ownership of the development just like everyone else. We will continue to use Toptal. As a startup, they are our secret weapon.
Brantley Pace, CEO & Co-Founder
I am more than pleased with our experience with Toptal. The professional I got to work with was on the phone with me within a couple of hours. I knew after discussing my project with him that he was the candidate I wanted. I hired him immediately and he wasted no time in getting to my project, even going the extra mile by adding some great design elements that enhanced our overall look.
Paul Fenley, Director
K Dunn & Associates
The developers I was paired with were incredible -- smart, driven, and responsive. It used to be hard to find quality engineers and consultants. Now it isn't.
Ryan Rockefeller, CEO
Toptal understood our project needs immediately. We were matched with an exceptional freelancer from Argentina who, from Day 1, immersed himself in our industry, blended seamlessly with our team, understood our vision, and produced top-notch results. Toptal makes connecting with superior developers and programmers very easy.
Jason Kulik, Co-Founder
As a small company with limited resources we can't afford to make expensive mistakes. Toptal provided us with an experienced programmer who was able to hit the ground running and begin contributing immediately. It has been a great experience and one we'd repeat again in a heartbeat.
Stuart Pocknee , Principal
Site Specific Software Solutions
We used Toptal to hire a developer with extensive Amazon Web Services experience. We interviewed four candidates, one of which turned out to be a great fit for our requirements. The process was quick and effective.
Abner Guzmán Rivera, CTO and Chief Scientist
Sergio was an awesome developer to work with. Top notch, responsive, and got the work done efficiently.
Dennis Baldwin, Chief Technologist and Co-Founder
Working with Marcin is a joy. He is competent, professional, flexible, and extremely quick to understand what is required and how to implement it.
André Fischer, CTO
We needed a expert engineer who could start on our project immediately. Simanas exceeded our expectations with his work. Not having to interview and chase down an expert developer was an excellent time-saver and made everyone feel more comfortable with our choice to switch platforms to utilize a more robust language. Toptal made the process easy and convenient. Toptal is now the first place we look for expert-level help.
Derek Minor, Senior VP of Web Development
Networld Media Group
Toptal's developers and architects have been both very professional and easy to work with. The solution they produced was fairly priced and top quality, reducing our time to launch. Thanks again, Toptal.
Jeremy Wessels, CEO
We had a great experience with Toptal. They paired us with the perfect developer for our application and made the process very easy. It was also easy to extend beyond the initial time frame, and we were able to keep the same contractor throughout our project. We definitely recommend Toptal for finding high quality talent quickly and seamlessly.
Ryan Morrissey, CTO
Applied Business Technologies, LLC
I'm incredibly impressed with Toptal. Our developer communicates with me every day, and is a very powerful coder. He's a true professional and his work is just excellent. 5 stars for Toptal.
Pietro Casoar, CEO
Ronin Play Pty Ltd
Working with Toptal has been a great experience. Prior to using them, I had spent quite some time interviewing other freelancers and wasn't finding what I needed. After engaging with Toptal, they matched me up with the perfect developer in a matter of days. The developer I'm working with not only delivers quality code, but he also makes suggestions on things that I hadn't thought of. It's clear to me that Amaury knows what he is doing. Highly recommended!
George Cheng, CEO
As a Toptal qualified front-end developer, I also run my own consulting practice. When clients come to me for help filling key roles on their team, Toptal is the only place I feel comfortable recommending. Toptal's entire candidate pool is the best of the best. Toptal is the best value for money I've found in nearly half a decade of professional online work.
Ethan Brooks, CTO
Langlotz Patent & Trademark Works, Inc.
In Higgle's early days, we needed the best-in-class developers, at affordable rates, in a timely fashion. Toptal delivered!
Lara Aldag, CEO
Toptal makes finding a candidate extremely easy and gives you peace-of-mind that they have the skills to deliver. I would definitely recommend their services to anyone looking for highly-skilled developers.
Michael Gluckman, Data Manager
Toptal’s ability to rapidly match our project with the best developers was just superb. The developers have become part of our team, and I’m amazed at the level of professional commitment each of them has demonstrated. For those looking to work remotely with the best engineers, look no further than Toptal.
Laurent Alis, Founder
Toptal makes finding qualified engineers a breeze. We needed an experienced ASP.NET MVC architect to guide the development of our start-up app, and Toptal had three great candidates for us in less than a week. After making our selection, the engineer was online immediately and hit the ground running. It was so much faster and easier than having to discover and vet candidates ourselves.
Jeff Kelly, Co-Founder
We needed some short-term work in Scala, and Toptal found us a great developer within 24 hours. This simply would not have been possible via any other platform.
Franco Arda, Co-Founder
Toptal offers a no-compromise solution to businesses undergoing rapid development and scale. Every engineer we've contracted through Toptal has quickly integrated into our team and held their work to the highest standard of quality while maintaining blazing development speed.
Greg Kimball, Co-Founder
How to Hire Python Developers through Toptal
Talk to One of Our Industry Experts
A Toptal director of engineering will work with you to understand your goals, technical needs, and team dynamics.
Work With Hand-Selected Talent
Within days, we'll introduce you to the right Python developer for your project. Average time to match is under 24 hours.
The Right Fit, Guaranteed
Work with your new Python developer for a trial period (pay only if satisfied), ensuring they're the right fit before starting the engagement.
Find Experts With Related Skills
Access a vast pool of skilled developers in our talent network and hire the top 3% within just 48 hours.
At Toptal, we thoroughly screen our Python developers to ensure we only match you with talent of the highest caliber. Of the more than 200,000 people who apply to join the Toptal network each year, fewer than 3% make the cut. You’ll work with engineering experts (never generalized recruiters or HR reps) to understand your goals, technical needs, and team dynamics. The end result: expert vetted talent from our network, custom matched to fit your business needs.
Can I hire Python contractors in less than 48 hours through Toptal?
Depending on availability and how fast you can progress, you could start working with a Python developer within 48 hours of signing up.
What is the no-risk trial period for Toptal Python developers?
We make sure that each engagement between you and your Python developer begins with a trial period of up to two weeks. This means that you have time to confirm the engagement will be successful. If you’re completely satisfied with the results, we’ll bill you for the time and continue the engagement for as long as you’d like. If you’re not completely satisfied, you won’t be billed. From there, we can either part ways, or we can provide you with another expert who may be a better fit and with whom we will begin a second, no-risk trial.
So how hard can it be to find a Python developer? Well, not very hard at all if the goal is just to find someone who can legitimately list Python on their resume. But if the goal is to find a Python guru who has truly mastered the nuances and power of the language, then the challenge is most certainly a formidable one.
First and foremost, a highly-effective recruiting process is needed, as described in our post In Search of the Elite Few – Finding and Hiring the Best Developers in the Industry. Such a process can then be augmented with targeted questions and techniques, such as those provided here, that are specifically geared toward ferreting out Python virtuosos from the plethora of some-level-of-Python-experience candidates.
Python Guru or Snake in the Grass?
So you’ve found what appears to be a strong Python web developer. How do you determine if he or she is, in fact, in the elite top 1% of candidates that you’re looking to hire? While there’s no magic or foolproof technique, there are certainly questions you can pose that will help determine the depth and sophistication of a candidate’s knowledge of the language. A brief sampling of such questions is provided below.
It is important to bear in mind, though, that these sample questions are intended merely as a guide. Not every “A” candidate worth hiring will be able to properly answer them all, nor does answering them all guarantee an “A” candidate. At the end of the day, hiring remains as much of an art as it does a science.
Python in the Weeds…
While it’s true that the best developers don’t waste time committing to memory that which can easily be found in a language specification or API document, there are certain key features and capabilities of any programming language that any expert can, and should, be expected to be well-versed in. Here are some Python-specific examples:
Q: Why use function decorators? Give an example.
A decorator is essentially a callable Python object that is used to modify or extend a function or class definition. One of the beauties of decorators is that a single decorator definition can be applied to multiple functions (or classes). Much can thereby be accomplished with decorators that would otherwise require lots of boilerplate (or even worse redundant!) code. Flask, for example, uses decorators as the mechanism for adding new endpoints to a web application. Examples of some of the more common uses of decorators include adding synchronization, type enforcement, logging, or pre/post conditions to a class or function.
Q: What are lambda expressions, list comprehensions and generator expressions? What are the advantages and appropriate uses of each?
Lambda expressions are a shorthand technique for creating single line, anonymous functions. Their simple, inline nature often – though not always – leads to more readable and concise code than the alternative of formal function declarations. On the other hand, their terse inline nature, by definition, very much limits what they are capable of doing and their applicability. Being anonymous and inline, the only way to use the same lambda function in multiple locations in your code is to specify it redundantly.
List comprehensions provide a concise syntax for creating lists. List comprehensions are commonly used to make lists where each element is the result of some operation(s) applied to each member of another sequence or iterable. They can also be used to create a subsequence of those elements whose members satisfy a certain condition. In Python, list comprehensions provide an alternative to using the built-in map() and filter() functions.
As the applied usage of lambda expressions and list comprehensions can overlap, opinions vary widely as to when and where to use one vs. the other. One point to bear in mind, though, is that a list comprehension executes somewhat faster than a comparable solution using map and lambda (some quick tests yielded a performance difference of roughly 10%). This is because calling a lambda function creates a new stack frame while the expression in the list comprehension is evaluated without doing so.
Generator expressions are syntactically and functionally similar to list comprehensions but there are some fairly significant differences between the ways the two operate and, accordingly, when each should be used. In a nutshell, iterating over a generator expression or list comprehension will essentially do the same thing, but the list comprehension will create the entire list in memory first while the generator expression will create the items on the fly as needed. Generator expressions can therefore be used for very large (and even infinite) sequences and their lazy (i.e., on demand) generation of values results in improved performance and lower memory usage. It is worth noting, though, that the standard Python list methods can be used on the result of a list comprehension, but not directly on that of a generator expression.
Q: Consider the two approaches below for initializing an array and the arrays that will result. How will the resulting arrays differ and why should you use one initialization approach vs. the other?
>>> # INITIALIZING AN ARRAY -- METHOD 1
>>> x = [[1,2,3,4]] * 3
[[1, 2, 3, 4], [1, 2, 3, 4], [1, 2, 3, 4]]
>>> # INITIALIZING AN ARRAY -- METHOD 2
>>> y = [[1,2,3,4] for _ in range(3)]
[[1, 2, 3, 4], [1, 2, 3, 4], [1, 2, 3, 4]]
>>> # WHICH METHOD SHOULD YOU USE AND WHY?
While both methods appear at first blush to produce the same result, there is an extremely significant difference between the two. Method 2 produces, as you would expect, an array of 3 elements, each of which is itself an independent 4-element array. In method 1, however, the members of the array all point to the same object. This can lead to what is most likely unanticipated and undesired behavior as shown below.
>>> # MODIFYING THE x ARRAY FROM THE PRIOR CODE SNIPPET:
>>> x = 99
[[1, 2, 3, 99], [1, 2, 3, 99], [1, 2, 3, 99]]
>>> # UH-OH, DON’T THINK YOU WANTED THAT TO HAPPEN!
>>> # MODIFYING THE y ARRAY FROM THE PRIOR CODE SNIPPET:
>>> y = 99
[[1, 2, 3, 99], [1, 2, 3, 4], [1, 2, 3, 4]]
>>> # THAT’S MORE LIKE WHAT YOU EXPECTED!
Q: What will be printed out by the second append() statement below?
>>> def append(list=):
... # append the length of a list to the list
... return list
['a', 'b', 2]
>>> append() # calling with no arg uses default list value of 
>>> append() # but what happens when we AGAIN call append with no arg?
When the default value for a function argument is an expression, the expression is evaluated only once, not every time the function is called. Thus, once the list argument has been initialized to an empty array, subsequent calls to append without any argument specified will continue to use the same array to which list was originally initialized. This will therefore yield the following, presumably unexpected, behavior:
>>> append() # first call with no arg uses default list value of 
>>> append() # but then look what happens...
>>> append() # successive calls keep extending the same default list!
[0, 1, 2]
>>> append() # and so on, and so on, and so on...
[0, 1, 2, 3]
Q: How might one modify the implementation of the ‘append’ method in the previous question to avoid the undesirable behavior described there?
The following alternative implementation of the append method would be one of a number of ways to avoid the undesirable behavior described in the answer to the previous question:
>>> def append(list=None):
... if list is None:
list = 
# append the length of a list to the list
... return list
Q: How can you swap the values of two variables with a single line of Python code?
Consider this simple example:
>>> x = 'X'
>>> y = 'Y'
In many other languages, swapping the values of x and y requires that you to do the following:
>>> tmp = x
>>> x = y
>>> y = tmp
>>> x, y
But in Python, makes it possible to do the swap with a single line of code (thanks to implicit tuple packing and unpacking) as follows:
>>> x,y = y,x
Q: What will be printed out by the last statement below?
>>> flist = 
>>> for i in range(3):
... flist.append(lambda: i)
>>> [f() for f in flist] # what will this print out?
In any closure in Python, variables are bound by name. Thus, the above line of code will print out the following:
[2, 2, 2]
Presumably not what the author of the above code intended!
A workaround is to either create a separate function or to pass the args by name; e.g.:
>>> flist = 
>>> for i in range(3):
... flist.append(lambda i = i : i)
>>> [f() for f in flist]
[0, 1, 2]
Q: What are the key differences between Python 2 and 3?
Although Python 2 is formally considered legacy at this point, its use is still widespread enough that is important for a python web developer to recognize the differences between Python 2 and 3.
Here are some of the key differences that a developer should be aware of:
Text and Data instead of Unicode and 8-bit strings. Python 3.0 uses the concepts of text and (binary) data instead of Unicode strings and 8-bit strings. The biggest ramification of this is that any attempt to mix text and data in Python 3.0 raises a TypeError (to combine the two safely, you must decode bytes or encode Unicode, but you need to know the proper encoding, e.g. UTF-8)
This addresses a longstanding pitfall for naïve Python programmers. In Python 2, mixing Unicode and 8-bit data would work if the string happened to contain only 7-bit (ASCII) bytes, but you would get UnicodeDecodeError if it contained non-ASCII values. Moreover, the exception would happen at the combination point, not at the point at which the non-ASCII characters were put into the str object. This behavior was a common source of confusion and consternation for neophyte Python programmers.
print function. The print statement has been replaced with a print() function
xrange – buh-bye.xrange() no longer exists (range() now behaves like xrange() used to behave, except it works with values of arbitrary size)
zip(), map() and filter() all now return iterators instead of lists
dict.keys(), dict.items() and dict.values() now return “views” instead of lists
dict.iterkeys(), dict.iteritems() and dict.itervalues() are no longer supported
Comparison operators. The ordering comparison operators (<, <=, >=, >) now raise a TypeError exception when the operands don’t have a meaningful natural ordering. Some examples of the ramifications of this include:
Expressions like 1 < '', 0 > None or len <= len are no longer valid
None < None now raises a TypeError instead of returning False
Sorting a heterogeneous list no longer makes sense – all the elements must be comparable to each other
More details on the differences between Python 2 and 3 are available here.
Q: Is Python interpreted or compiled?
As noted in Why Are There So Many Pythons?, this is, frankly, a bit of a trick question in that it is malformed. Python itself is nothing more than an interface definition (as is true with any language specification) of which there are multiple implementations. Accordingly, the question of whether “Python” is interpreted or compiled does not apply to the Python language itself; rather, it applies to each specific implementation of the Python specification.
Further complicating the answer to this question is the fact that, in the case of CPython (the most common Python implementation), the answer really is “sort of both”. Specifically, with CPython, code is first compiled and then interpreted. More precisely, it is not precompiled to native machine code, but rather to bytecode. While machine code is certainly faster, bytecode is more portable and secure. The bytecode is then interpreted in the case of CPython (or both interpreted and compiled to optimized machine code at runtime in the case of PyPy).
Q: What are some alternative implementations to CPython? When and why might you use them?
One of the more prominent alternative implementations is Jython, a Python implementation written in Java that utilizes the Java Virtual Machine (JVM). While CPython produces bytecode to run on the CPython VM, Jython produces Java bytecode to run on the JVM.
Another is IronPython, written in C# and targeting the .NET stack. IronPython runs on Microsoft’s Common Language Runtime (CLR).
As also pointed out in Why Are There So Many Pythons?, it is entirely possible to survive without ever touching a non-CPython implementation of Python, but there are advantages to be had from switching, most of which are dependent on your technology stack.
Another noteworthy alternative implementation is PyPy whose key features include:
Speed. Thanks to its Just-in-Time (JIT) compiler, Python programs often run faster on PyPy.
Memory usage. Large, memory-hungry Python programs might end up taking less space with PyPy than they do in CPython.
Compatibility. PyPy is highly compatible with existing python code. It supports cffi and can run popular Python libraries like Twisted and Django.
Sandboxing. PyPy provides the ability to run untrusted code in a fully secure way.
Stackless mode. PyPy comes by default with support for stackless mode, providing micro-threads for massive concurrency.
Q: What’s your approach to unit testing in Python?
The most fundamental answer to this question centers around Python’s unittest testing framework. Basically, if a python automation candidate doesn’t mention unittest when answering this question, that should be a huge red flag.
unittest supports test automation, sharing of setup and shutdown code for tests, aggregation of tests into collections, and independence of the tests from the reporting framework. The unittest module provides classes that make it easy to support these qualities for a set of tests.
Assuming that the candidate does mention unittest (if they don’t, you may just want to end the interview right then and there!), you should also ask them to describe the key elements of the unittest framework; namely, test fixtures, test cases, test suites and test runners.
A more recent addition to the unittest framework is mock. mock allows you to replace parts of your system under test with mock objects and make assertions about how they are to be used. mock is now part of the Python standard library, available as unittest.mock in Python 3.3 onwards.
The value and power of mock are well explained in An Introduction to Mocking in Python. As noted therein, system calls are prime candidates for mocking: whether writing a script to eject a CD drive, a web server which removes antiquated cache files from /tmp, or a socket server which binds to a TCP port, these calls all feature undesired side-effects in the context of unit tests. Similarly, keeping your unit-tests efficient and performant means keeping as much “slow code” as possible out of the automated test runs, namely filesystem and network access.
[Note: This question is for Python developers who are also experienced in Java.] Q: What are some key differences to bear in mind when coding in Python vs. Java?
Disclaimer #1. The differences between Java and Python are numerous and would likely be a topic worthy of its own (lengthy) post. Below is just a brief sampling of some key differences between the two languages.
Disclaimer #2. The intent here is not to launch into a religious battle over the merits of Python vs. Java (as much fun as that might be!). Rather, the question is really just geared at seeing how well the developer understands some practical differences between the two languages. The list below therefore deliberately avoids discussing the arguable advantages of Python over Java from a programming productivity perspective.
With the above two disclaimers in mind, here is a sampling of some key differences to bear in mind when coding in Python vs. Java:
Dynamic vs static typing. One of the biggest differences between the two languages is that Java is restricted to static typing whereas Python supports dynamic typing of variables.
Static vs. class methods. A static method in Java does not translate to a Python class method.
In Python, calling a class method involves an additional memory allocation that calling a static method or function does not.
In Java, dotted names (e.g., foo.bar.method) are looked up by the compiler, so at runtime it really doesn’t matter how many of them you have. In Python, however, the lookups occur at runtime, so “each dot counts”.
Method overloading. Whereas Java requires explicit specification of multiple same-named functions with different signatures, the same can be accomplished in Python with a single function that includes optional arguments with default values if not specified by the caller.
Single vs. double quotes. Whereas the use of single quotes vs. double quotes has significance in Java, they can be used interchangeably in Python (but no, it won’t allow beginnning the same string with a double quote and trying to end it with a single quote, or vice versa!).
Getters and setters (not!). Getters and setters in Python are superfluous; rather, you should use the ‘property’ built-in (that’s what it’s for!). In Python, getters and setters are a waste of both CPU and programmer time.
Classes are optional. Whereas Java requires every function to be defined in the context of an enclosing class definition, Python has no such requirement.
Indentation matters… in Python. This bites many a newbie Python programmer.
The Big Picture
An expert knowledge of Python extends well beyond the technical minutia of the language. A Python expert will have an in-depth understanding and appreciation of Python’s benefits as well as its limitations. Accordingly, here are some sample questions that can help assess this dimension of a candidate’s expertise:
Q: What is Python particularly good for? When is using Python the “right choice” for a project?
Although likes and dislikes are highly personal, a developer who is “worth his or her salt” will highlight features of the Python language that are generally considered advantageous (which also helps answer the question of what Python is “particularly good for”). Some of the more common valid answers to this question include:
Ease of use and ease of refactoring, thanks to the flexibility of Python’s syntax, which makes it especially useful for rapid prototyping.
More compact code, thanks again to Python’s syntax, along with a wealth of functionally-rich Python libraries (distributed freely with most Python language implementations).
A dynamically-typed and strongly-typed language, offering the rare combination of code flexibility while at the same time avoiding pesky implicit-type-conversion bugs.
It’s free and open source! Need we say more?
With regard to the question of when using Python is the “right choice” for a project, the complete answer also depends on a number of issues orthogonal to the language itself, such as prior technology investment, skill set of the team, and so on. Although the question as stated above implies interest in a strictly technical answer, a developer who will raise these additional issues in an interview will always “score more points” with me since it indicates an awareness of, and sensitivity to, the “bigger picture” (i.e., beyond just the technology being employed). Conversely, a response that Python is always the right choice is a clear sign of an unsophisticated developer.
Q: What are some drawbacks of the Python language?
For starters, if you know a language well, you know its drawbacks, so responses such as “there’s nothing I don’t like about it” or “it has no drawbacks” are very telling indeed.
The two most common valid answers to this question (by no means intended as an exhaustive list) are:
The Global Interpreter Lock (GIL). CPython (the most common Python implementation) is not fully thread safe. In order to support multi-threaded Python programs, CPython provides a global lock that must be held by the current thread before it can safely access Python objects. As a result, no matter how many threads or processors are present, only one thread is ever being executed at any given time. In comparison, it is worth noting that the PyPy implementation discussed earlier in this article provides a stackless mode that supports micro-threads for massive concurrency.
Execution speed. Python can be slower than compiled languages since it is interpreted. (Well, sort of. See our earlier discussion on this topic.)
The questions and tips presented herein can be extremely valuable aids in identifying true Python development masters. We hope you find them to be a useful foundation for “separating the wheat from the chaff” in your quest for the elite few among Python software developers. Yet it is important to remember that these are merely intended as tools to be incorporated into the larger context of your overall recruiting toolbox and strategy.
And, for those who may have mistakenly read this guide hoping to learn how to capture a reptile (sorry dude, wrong kind of python!), we recommend instead checking out the Wildlife Foundation of Florida’s Python Challenge.