Skip to main content
Log in

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

  • Published:
Empirical Software Engineering Aims and scope Submit manuscript

Abstract

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.

This is a preview of subscription content, log in via an institution to check access.

Access this article

Price excludes VAT (USA)
Tax calculation will be finalised during checkout.

Instant access to the full article PDF.

Fig. 1
Fig. 2
Fig. 3
Fig. 4
Fig. 5
Fig. 6
Fig. 7
Fig. 8

Similar content being viewed by others

Thomas Weißgerber, Mehdi Ben Amor, … Michael Granitzer

References

  • Åkerblom B, Stendahl J, Tumlin M, Wrigstad T (2014) Tracing dynamic features in Python programs. In: Working conference on mining software repositories, pp 292–295

  • Benson D (2017) Different C standards: The story of C. http://opensourceforu.com/2017/04/different-c-standards-story-c/

  • Cannon B (2013) Python 3.3: Trust me, it’s better than 2.7. Pycon

  • Cannon B (2017) Porting Python 2 code to Python 3. https://docs.python.org/3/howto/pyporting.html, Accessed 04 Apr 2017

  • Chapman C, Stolee KT (2016) Exploring regular expression usage and context in Python. In: International Symposium on software testing and analysis, pp 282–293

  • 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–23

  • Coghlan N (2012) Python 3 Q&A. http://python-notes.curiousefficiency.org/en/latest/python3/questions_and_answers.html#other-changes, Accessed 03 Apr 2017

  • 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–28

  • 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–790

  • Gee S (2014) Python 2.7 to be maintained until 2020. http://www.i-programmer.info/news/216-python/7179-python-27-to-be-maintained-until-2020.html, Accessed 03 April 2017

  • 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–42

  • 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–260

  • 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–2071

    Article  Google Scholar 

  • Klint P, Lämmel R, Verhoef C (2005) Toward an engineering discipline for grammarware. ACM Trans Softw Eng Methodol 14(3):331–380

    Article  Google Scholar 

  • Lȧmmel R (2001) Grammar adaptation. In: Formal Methods Europe, LNCS, vol 2021, pp 550–570

  • Lämmel R, Zaytsev V (2009) An introduction to grammar convergence. In: Integrated Formal methods, LNCS, vol 5423, pp 246- 260

  • 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–199

  • Lindstrom G (2005) Programming with Python. IT Prof 7:10–16

    Article  Google Scholar 

  • 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–392

  • Malloy BA, Power JF (2016) Deriving grammar transformations for developing and maintaining multiple parser versions. In: Workshop on Parsing@SLE

  • 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 measurement

  • Malloy BA, Linde SA, Duffy EB, Power JF (2002a) Testing C++ compilers for ISO language conformance. Dr Dobb’s J 27(6):71–80

    Google Scholar 

  • 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–82

  • Malloy BA, Gibbs TH, Power JF (2003) Progression toward conformance for C++ language compilers. Dr Dobb’s J 28(11):54–60

    Google Scholar 

  • 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–15

  • 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:4

  • 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–315

  • 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–12

  • Perl 5 Porters (2017) Perl programming documentation. https://perldoc.perl.org/perlpolicy.html, Accessed 18 Dec 2017

  • Power JF, Malloy BA (2004) A metrics suite for grammar-based software. Softw Mainten Evol 16(6):405–426

    Article  Google Scholar 

  • Rajagopal I (2017) 10 awesome features of Python that you can’t use because you refuse to upgrade to Python 3. http://www.asmeurer.com/python3-presentation/slides.html#1?utm_source=hashnode.com, Accessed 18 Dec 2017

  • 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–291

  • Sipser M (2012) Introduction to the theory of computation. Cengage Learning

  • 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–345

  • Toal R, Rivera R, Schneider A, Choe E (2016) Programming language explorations. CRC Press

  • Urma RG (2017) Programming language evolution. Tech. Rep UCAM-CL-TR-902. Univ. of Cambridge, Computer Laboratory

  • Urma RG, Orchard D, Mycroft A (2014) Programming language evolution workshop report. In: Workshop on programming language evolution, pp 1–3

  • 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–139

  • Wikipedia (2017) Perl — Wikipedia, the free encyclopedia. https://en.wikipedia.org/w/index.php?title=Perl&oldid=815811945, Accessed 21 Dec 2017

  • Zaytsev V (2014) Negotiated grammar evolution. J Object Technol 13(3):1,1–22

    Article  Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to James F. Power.

Additional information

Communicated by: Burak Turhan

Publisher’s Note

Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.

Rights and permissions

Reprints and permissions

About this article

Check for updates. Verify currency and authenticity via CrossMark

Cite this article

Malloy, B.A., Power, J.F. An empirical analysis of the transition from Python 2 to Python 3. Empir Software Eng 24, 751–778 (2019). https://doi.org/10.1007/s10664-018-9637-2

Download citation

  • Published:

  • Issue Date:

  • DOI: https://doi.org/10.1007/s10664-018-9637-2

Keywords

Navigation