A new survey from the Python Software Foundation has found that while Python 3 remains dominant both for work and play, usage of Python 2 crept up from the previous year.
The study, in association with JetBrains which polled more than 23,000 Python developers, found 93% of respondents had already implemented Python 3, based on responses from the end of 2022. Yet this was down on the 95% cited from the previous year.
To find a reason why, there are a few small clues based on Python version use cases. Python 2 remains more popular for less common use cases, ranging from computer graphics (24% of respondents citing Python 2 versus 11% for Python 3), to game development (13%/8%), mobile development (13%/5%) and multimedia app development (11%/5%).
In contrast, the most common use cases, data analysis (54%/29%), web development (46%/19%) and machine learning (38%/13%) showed the clearest lean towards Python 3. DevOps, sysadmin and writing automation scripts, which were categorised in one bucket in the report, saw a slight preference towards the previous iteration, with 23% for Python 2 and 36% for 3.
This lean could also be seen in assessing whether Python was a primary or secondary language for developers polled across use cases. For DevOps, sysadmin and automation, there was little to choose; 35% use Python as primary and 34% secondary. For the three primary use cases however – data analysis (53% primary, 44% secondary), web development (45%/31%) and machine learning (37%/29%) – there was greater separation.
When it came to web frameworks, it was a dead heat between Flask and Django at 39% apiece. FastAPI was cited by one in four Python developers, gaining four percentage points on the previous year.
Overall, more than half of those polled (51%) said they used Python both for work and personal projects. Only one in five (21%) said they used Python exclusively for work, compared with 28% who use the language exclusively for educational, personal, or side projects.
The survey results which showed a slight uptick for Python 2 makes for interesting timing, coming in the same week that Python 3.12.0 was officially released. New features include more flexible f-string parsing, support for the buffer protocol in Python code, as well as a new debugging/profiling API. You can see the full list of features here.
Want to learn more about cybersecurity and the cloud from industry leaders? Check out Cyber Security & Cloud Expo taking place in Amsterdam, California, and London. The comprehensive event is co-located with AI & Big Data Expo Europe.
Explore other upcoming enterprise technology events and webinars powered by TechForge here.