Empirical Software Engineering

, Volume 24, Issue 2, pp 751–778 | Cite as

An empirical analysis of the transition from Python 2 to Python 3

  • Brian A. Malloy
  • James F. PowerEmail author


Python is one of the most popular and widely adopted programming languages in use today. In 2008 the Python developers introduced a new version of the language, Python 3.0, that was not backward compatible with Python 2, initiating a transitional phase for Python software developers. In this paper, we describe a study that investigates the degree to which Python software developers are making the transition from Python 2 to Python 3. We have developed a Python compliance analyser, PyComply, and have analysed a previously studied corpus of Python applications called Qualitas. We use PyComply to measure and quantify the degree to which Python 3 features are being used, as well as the rate and context of their adoption in the Qualitas corpus. Our results indicate that Python software developers are not exploiting the new features and advantages of Python 3, but rather are choosing to retain backward compatibility with Python 2. Moreover, Python developers are confining themselves to a language subset, governed by the diminishing intersection of Python 2, which is not under development, and Python 3, which is under development with new features being introduced as the language continues to evolve.


Python programming Programming language evolution Compliance 



  1. Åkerblom B, Stendahl J, Tumlin M, Wrigstad T (2014) Tracing dynamic features in Python programs. In: Working conference on mining software repositories, pp 292–295Google Scholar
  2. Benson D (2017) Different C standards: The story of C.
  3. Cannon B (2013) Python 3.3: Trust me, it’s better than 2.7. PyconGoogle Scholar
  4. Cannon B (2017) Porting Python 2 code to Python 3., Accessed 04 Apr 2017
  5. Chapman C, Stolee KT (2016) Exploring regular expression usage and context in Python. In: International Symposium on software testing and analysis, pp 282–293Google Scholar
  6. Chen Z, Chen L, Ma W, Xu B (2016) Detecting code smells in Python programs. In: International Conference on software analysis, testing and evolution, pp 18–23Google Scholar
  7. Destefanis G, Ortu M, Porru S, Swift S, Marchesi M (2016) A statistical comparison of Java and Python software metric properties. In: International Workshop on emerging trends in software metrics, pp 22–28Google Scholar
  8. Dyer R, Rajan H, Nguyen HA, Nguyen TN (2014) Mining billions of AST nodes to study actual and potential usage of Java language features. In: International Conference on software engineering, pp 779–790Google Scholar
  9. Gee S (2014) Python 2.7 to be maintained until 2020., Accessed 03 April 2017
  10. Gorbovitski M, Liu YA, Stoller SD, Rothamel T, Tekle TK (2010) Alias analysis for optimization of dynamic languages. In: 6th Symposium on dynamic languages, pp 27–42Google Scholar
  11. Hora A, Robbes R, Anquetil N, Etien A, Ducasse S, Valente MT (2015) How do developers react to API evolution? the Pharo ecosystem case. In: International Conference on software maintenance and evolution, pp 251–260Google Scholar
  12. Kalliamvakou E, Gousios G, Blincoe K, Singer L, German DM, Damian D (2016) An in-depth study of the promises and perils of mining GitHub. Empir Softw Eng 21(5):2035–2071CrossRefGoogle Scholar
  13. Klint P, Lämmel R, Verhoef C (2005) Toward an engineering discipline for grammarware. ACM Trans Softw Eng Methodol 14(3):331–380CrossRefGoogle Scholar
  14. Lȧmmel R (2001) Grammar adaptation. In: Formal Methods Europe, LNCS, vol 2021, pp 550–570Google Scholar
  15. Lämmel R, Zaytsev V (2009) An introduction to grammar convergence. In: Integrated Formal methods, LNCS, vol 5423, pp 246- 260Google Scholar
  16. Lin W, Chen Z, Ma W, Chen L, Xu L, Xu B (2016) An empirical study on the characteristics of Python fine-grained source code change types. In: International Conference on software maintenance and evolution, pp 188–199Google Scholar
  17. Lindstrom G (2005) Programming with Python. IT Prof 7:10–16CrossRefGoogle Scholar
  18. Ma W, Chen L, Zhang X, Zhou Y, Xu B (2017) How do developers fix cross-project correlated bugs? In: International Conference on software engineering, pp 381–392Google Scholar
  19. Malloy BA, Power JF (2016) Deriving grammar transformations for developing and maintaining multiple parser versions. In: Workshop on Parsing@SLEGoogle Scholar
  20. Malloy BA, Power JF (2017) Quantifying the transition from Python 2 to 3: an empirical study of Python applications. In: ACM/IEEE International symposium on empirical software engineering and measurementGoogle Scholar
  21. Malloy BA, Linde SA, Duffy EB, Power JF (2002a) Testing C++ compilers for ISO language conformance. Dr Dobb’s J 27(6):71–80Google Scholar
  22. Malloy BA, Power JF, Waldron JT (2002b) Applying software engineering techniques to parser design: the development of a C# parser. In: Conference of the South African institute of computer scientists and information technologists. Port Elizabeth, pp 75–82Google Scholar
  23. Malloy BA, Gibbs TH, Power JF (2003) Progression toward conformance for C++ language compilers. Dr Dobb’s J 28(11):54–60Google Scholar
  24. Memarian K, Matthiesen J, Lingard J, Nienhuis K, Chisnall D, Watson RNM, Sewell P (2016) Into the depths of C: elaborating the de facto standards. In: Programming Language design and implementation, pp 1–15Google Scholar
  25. Orrù M, Tempero E, Marchesi M, Tonelli R, Destefanis G (2015a) A curated benchmark collection of Python systems for empirical studies on software engineering. In: International Conference on predictive models and data analytics in software engineering, pp 2:1–2:4Google Scholar
  26. Orrù M, Tempero ED, Marchesi M, Tonelli R (2015b) How do Python programs use inheritance? A replication study. In: Asia-Pacific Software engineering conference, pp 309–315Google Scholar
  27. Parnin C, Bird C, Murphy-Hill E (2011) Java generics adoption: how new features are introduced, championed, or ignored. In: Working Conference on mining software repositories, pp 3–12Google Scholar
  28. Perl 5 Porters (2017) Perl programming documentation., Accessed 18 Dec 2017
  29. Power JF, Malloy BA (2004) A metrics suite for grammar-based software. Softw Mainten Evol 16(6):405–426CrossRefGoogle Scholar
  30. Rajagopal I (2017) 10 awesome features of Python that you can’t use because you refuse to upgrade to Python 3., Accessed 18 Dec 2017
  31. Sharma P, Savarimuthu BTR, Stanger N, Licorish SA, Rainer A (2017) Investigating developers’ email discussions during decision-making in Python language evolution. In: International Conference on evaluation and assessment in software engineering. ACM, New York, pp 286–291Google Scholar
  32. Sipser M (2012) Introduction to the theory of computation. Cengage LearningGoogle Scholar
  33. Tempero E, Anslow C, Dietrich J, Han T, Li J, Lumpe M, Melton H, Noble J (2010) Qualitas corpus: a curated collection of Java code for empirical studies. In: Asia Pacific Software engineering conference, pp 336–345Google Scholar
  34. Toal R, Rivera R, Schneider A, Choe E (2016) Programming language explorations. CRC PressGoogle Scholar
  35. Urma RG (2017) Programming language evolution. Tech. Rep UCAM-CL-TR-902. Univ. of Cambridge, Computer LaboratoryGoogle Scholar
  36. Urma RG, Orchard D, Mycroft A (2014) Programming language evolution workshop report. In: Workshop on programming language evolution, pp 1–3Google Scholar
  37. Wang B, Chen L, Ma W, Chen Z, Xu B (2015) An empirical study on the impact of Python dynamic features on change-proneness. In: International Conference on software engineering and knowledge engineering, pp 134–139Google Scholar
  38. Wikipedia (2017) Perl — Wikipedia, the free encyclopedia., Accessed 21 Dec 2017
  39. Zaytsev V (2014) Negotiated grammar evolution. J Object Technol 13(3):1,1–22CrossRefGoogle Scholar

Copyright information

© Springer Science+Business Media, LLC, part of Springer Nature 2018

Authors and Affiliations

  1. 1.Computer Science DepartmentClemson UniversityClemsonUSA
  2. 2.Computer Science DepartmentMaynooth UniversityCo. KildareIreland

Personalised recommendations