

{"id":71328,"date":"2019-10-17T17:34:41","date_gmt":"2019-10-17T12:04:41","guid":{"rendered":"https:\/\/data-flair.training\/blogs\/?p=71328"},"modified":"2026-04-25T12:20:29","modified_gmt":"2026-04-25T06:50:29","slug":"whats-new-in-python","status":"publish","type":"post","link":"https:\/\/data-flair.training\/blogs\/whats-new-in-python\/","title":{"rendered":"What&#8217;s new in Python 3.8? &#8211; Unveiling the Latest Features of Python"},"content":{"rendered":"<p>Python has officially released its latest version Python 3.8 on 14th October 2019. This release has rolled out some great new features for all the Python programmers.<\/p>\n<p>Python 3.8 is faster than ever with some major improvements in its performance.<\/p>\n<p>In this Python 3.8 tutorial, let\u2019s see what has been changed from its previous version 3.7.<\/p>\n<h3>Python 3.8 Features<\/h3>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/whats-new-in-python-3.8.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-71338\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/whats-new-in-python-3.8.jpg\" alt=\"whats new in python 3.8 - Python 3.8 Features\" width=\"802\" height=\"420\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/whats-new-in-python-3.8.jpg 802w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/whats-new-in-python-3.8-150x79.jpg 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/whats-new-in-python-3.8-300x157.jpg 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/whats-new-in-python-3.8-768x402.jpg 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/whats-new-in-python-3.8-520x272.jpg 520w\" sizes=\"auto, (max-width: 802px) 100vw, 802px\" \/><\/a><\/p>\n<p>Now, we will quickly dive into the latest features of Python 3.8:<\/p>\n<h4>1. PEP 572 (Assignment Expressions) &#8211; The walrus operator (:=) in Python<\/h4>\n<p>You will get to see a new type of operator which is being known as the walrus operator (:=).<\/p>\n<p>This allows you to assign variables inside an expression. The major benefit of this is to save you some lines of code and you can write even cleaner and compact code in Python.<\/p>\n<p><strong>Example of Walrus Operator in Python<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">num = [1,2,3,4,5]\r\nif( (size:=len(num)) &lt; 10 ):\r\n  print(f\u201dLength of list is small, size={size}\u201d)<\/pre>\n<p><strong>Example 2<\/strong><\/p>\n<p>This can be useful while writing loops, something like this.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">Item = getItem()\r\nwhile Item:\r\n  do_something(item)\r\n  Item = getItem()<\/pre>\n<p>Can be written as:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">while Item:= getItem():\r\n  do_something(Item)<\/pre>\n<p><strong>Example 3<\/strong><\/p>\n<p>Simplifying list comprehensions when filtering a value<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">[y for x in data if (y := f(x)) is not None]<\/pre>\n<h4>2. PEP 570 (Positional only arguments) in Python<\/h4>\n<p>There is a new function parameter syntax (\/) to highlight that some of the functions must be stated positionally and not by keyword arguments.<\/p>\n<p>We also have an operator (*) that indicates that the arguments must be keyword only.<\/p>\n<p>This can be a little confusing but after seeing the code this gets easier to understand, so let\u2019s see them in action.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">def func(a, b, c, d):\r\n  print(a,b,c,d)\r\n<\/pre>\n<p>We can call this function however we want with keyword arguments or positions.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">func(d=2, a=3, b=2, c=6) #Valid - prints 3 2 6 2\r\nfunc(1,3,4,5) #Valid - prints 1 2 4 5\r\n<\/pre>\n<p>Now consider the following definition:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">def func( a,b,\/,c,d,*,e,f ):\r\n  print(a,b,c,d,e,f )<\/pre>\n<p>This will impose the way we can call this function:<\/p>\n<ul>\n<li>a and b arguments are positional only.<\/li>\n<li>c and d arguments can be positional as well as keyword.<\/li>\n<li>e and f arguments are keyword only.<\/li>\n<\/ul>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">func(1,2, 3,4, e=5, f=6 ) #Valid - prints 1 2 3 4 5 6\r\nfunc(1,2, c=3,d=4, e=5, f=6 ) #Valid - prints 1 2 3 4 5 6<\/pre>\n<p>However, these calls will be invalid<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">func(a=1,b=2, 3,4, e=5, f=6 ) #Invalid - Error : a and b arguments are positional only \r\nfunc(1,2, c=3,d=4, 5, 6 ) #Invalid - Error : e and f are keyword only arguments.<\/pre>\n<h4>3. PEP 590 ( Vectorcall) in Python<\/h4>\n<p>This release has made some improvements in the vector call, which is a fast calling protocol for CPython.<\/p>\n<p>A new C API is introduced to optimize the calls to objects.<\/p>\n<p>This feature was already used in CPython, but with the new C API, the \u201cfastcall\u201d convention can be used by a user-defined extension class.<\/p>\n<p><strong>Features of Vectorcall in Python:<\/strong><\/p>\n<ul>\n<li>It stops creating space-occupying folders that are created just to share information with a function.<\/li>\n<li>Actions like making a string or a list make everyday activities faster.<\/li>\n<li>It helps outside tools like math and data libraries to run at the same speed as Python\u2019s built-in features.<\/li>\n<\/ul>\n<h4>4. PEP 574 ( Pickle Protocol 5 with out-of-band data)<\/h4>\n<p>Pickle is useful to transfer large amounts of data between Python processors to take full advantage of multicore processors.<\/p>\n<p>It\u2019s important to maximize the transfer speed by optimizing memory copies. Pickle protocol 5 now supports out-of-band data buffers, and extra metadata is required.<\/p>\n<ul>\n<li><strong>PickleBuffer<\/strong> type for <strong>__reduce_ex__<\/strong> returns out-of-band buffers.<\/li>\n<li><strong>buffer_callback<\/strong> parameter while pickling handles out-of-band data buffers.<\/li>\n<li><strong>buffers<\/strong> parameter while unpickling shows out-of-band data buffers.<\/li>\n<\/ul>\n<h4>5. F-strings now support = (Easy debugging)<\/h4>\n<p>A small improvement has been made in the f-strings formatting. They can now support the = operator in f-strings, which makes debugging easier.<\/p>\n<p>In previous <a href=\"https:\/\/www.python.org\/doc\/versions\/\">Python versions<\/a>, this would give you a Syntax Error:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">A = 5\r\nprint(f\u2019{A=}\u2019)<\/pre>\n<p>Now, from Python 3.8, we can do the following<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">A=5\r\nprint(f\u201d{A=}\u201d) #prints : A=5<\/pre>\n<h4>6. Improved Typing<\/h4>\n<p><strong>1 PEP 591 ( Final qualifier ) in Python<\/strong><\/p>\n<p>Python now supports the \u201cfinal\u201d. Java programmers already know about this. It has 3 major uses:<\/p>\n<ul>\n<li>Declaring a class final will prevent it from inheriting.<\/li>\n<li>Declaring a variable final will prevent it from being reassigned.<\/li>\n<li>Declaring a method final will prevent it from being overridden.<\/li>\n<\/ul>\n<p><strong>2 PEP 586 (Literal types ) in Python<\/strong><\/p>\n<p>Literal types are useful to know the literal value of an attribute or a variable. They are useful in type checking.<\/p>\n<p>Consider this expression:<\/p>\n<p><em>0== False<\/em><\/p>\n<p>This will give True as a result, but 0 is of type integer, and False is of type bool. So with literal, we can force type checks to be literally some specific type.<\/p>\n<h3>Python 3.8 Interview Questions<\/h3>\n<p>1. What is the Walrus Operator in Python?<\/p>\n<p>2. What is Python 3.8 6rc1?<\/p>\n<p>3. Tell some of the features in Python 3.8?<\/p>\n<p>4. What are the uses of Final Qualifier in Python?<\/p>\n<p>5. Compare Python 2 vs Python 3.<\/p>\n<p>6. Explain how the latest version improved typing.<\/p>\n<h3>Summary<\/h3>\n<p>These are all the new features in Python 3.8.<\/p>\n<p>It is safe to upgrade to Python 3.8 and start experimenting with new features like assignment expressions and positional-only arguments.<span hidden class=\"__iawmlf-post-loop-links\" data-iawmlf-links=\"[{&quot;id&quot;:1368,&quot;href&quot;:&quot;https:\\\/\\\/www.python.org\\\/doc\\\/versions&quot;,&quot;archived_href&quot;:&quot;&quot;,&quot;redirect_href&quot;:&quot;https:\\\/\\\/www.python.org\\\/doc\\\/versions\\\/&quot;,&quot;checks&quot;:[],&quot;broken&quot;:false,&quot;last_checked&quot;:null,&quot;process&quot;:&quot;done&quot;}]\"><\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Python has officially released its latest version Python 3.8 on 14th October 2019. This release has rolled out some great new features for all the Python programmers. Python 3.8 is faster than ever with&#46;&#46;&#46;<\/p>\n","protected":false},"author":7,"featured_media":71338,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[46],"tags":[21295,21291,21292,21293,21294],"class_list":["post-71328","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-python","tag-pep-570","tag-python-3-8","tag-python-3-8-features","tag-python-3-8-tutorial","tag-whats-new-in-python-3-8"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.8 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>What&#039;s new in Python 3.8? - Unveiling the Latest Features of Python - DataFlair<\/title>\n<meta name=\"description\" content=\"Python 3.8 Tutorial - Know about the latest features of Python 3.8 that will reduce your hassles &amp; improve performance of your Python code.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/data-flair.training\/blogs\/whats-new-in-python\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"What&#039;s new in Python 3.8? - Unveiling the Latest Features of Python - DataFlair\" \/>\n<meta property=\"og:description\" content=\"Python 3.8 Tutorial - Know about the latest features of Python 3.8 that will reduce your hassles &amp; improve performance of your Python code.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/data-flair.training\/blogs\/whats-new-in-python\/\" \/>\n<meta property=\"og:site_name\" content=\"DataFlair\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/DataFlairWS\/\" \/>\n<meta property=\"article:published_time\" content=\"2019-10-17T12:04:41+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2026-04-25T06:50:29+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/whats-new-in-python-3.8.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"802\" \/>\n\t<meta property=\"og:image:height\" content=\"420\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"DataFlair Team\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@DataFlairWS\" \/>\n<meta name=\"twitter:site\" content=\"@DataFlairWS\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"DataFlair Team\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"What's new in Python 3.8? - Unveiling the Latest Features of Python - DataFlair","description":"Python 3.8 Tutorial - Know about the latest features of Python 3.8 that will reduce your hassles & improve performance of your Python code.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/data-flair.training\/blogs\/whats-new-in-python\/","og_locale":"en_US","og_type":"article","og_title":"What's new in Python 3.8? - Unveiling the Latest Features of Python - DataFlair","og_description":"Python 3.8 Tutorial - Know about the latest features of Python 3.8 that will reduce your hassles & improve performance of your Python code.","og_url":"https:\/\/data-flair.training\/blogs\/whats-new-in-python\/","og_site_name":"DataFlair","article_publisher":"https:\/\/www.facebook.com\/DataFlairWS\/","article_published_time":"2019-10-17T12:04:41+00:00","article_modified_time":"2026-04-25T06:50:29+00:00","og_image":[{"width":802,"height":420,"url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/whats-new-in-python-3.8.jpg","type":"image\/jpeg"}],"author":"DataFlair Team","twitter_card":"summary_large_image","twitter_creator":"@DataFlairWS","twitter_site":"@DataFlairWS","twitter_misc":{"Written by":"DataFlair Team","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/data-flair.training\/blogs\/whats-new-in-python\/#article","isPartOf":{"@id":"https:\/\/data-flair.training\/blogs\/whats-new-in-python\/"},"author":{"name":"DataFlair Team","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/person\/beb0cab24b7aa54423a3b50e669a9dcd"},"headline":"What&#8217;s new in Python 3.8? &#8211; Unveiling the Latest Features of Python","datePublished":"2019-10-17T12:04:41+00:00","dateModified":"2026-04-25T06:50:29+00:00","mainEntityOfPage":{"@id":"https:\/\/data-flair.training\/blogs\/whats-new-in-python\/"},"wordCount":703,"commentCount":3,"publisher":{"@id":"https:\/\/data-flair.training\/blogs\/#organization"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/whats-new-in-python\/#primaryimage"},"thumbnailUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/whats-new-in-python-3.8.jpg","keywords":["PEP 570","Python 3.8","python 3.8 features","python 3.8 tutorial","what's new in python 3.8"],"articleSection":["Python Tutorials"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/data-flair.training\/blogs\/whats-new-in-python\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/data-flair.training\/blogs\/whats-new-in-python\/","url":"https:\/\/data-flair.training\/blogs\/whats-new-in-python\/","name":"What's new in Python 3.8? - Unveiling the Latest Features of Python - DataFlair","isPartOf":{"@id":"https:\/\/data-flair.training\/blogs\/#website"},"primaryImageOfPage":{"@id":"https:\/\/data-flair.training\/blogs\/whats-new-in-python\/#primaryimage"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/whats-new-in-python\/#primaryimage"},"thumbnailUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/whats-new-in-python-3.8.jpg","datePublished":"2019-10-17T12:04:41+00:00","dateModified":"2026-04-25T06:50:29+00:00","description":"Python 3.8 Tutorial - Know about the latest features of Python 3.8 that will reduce your hassles & improve performance of your Python code.","breadcrumb":{"@id":"https:\/\/data-flair.training\/blogs\/whats-new-in-python\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/data-flair.training\/blogs\/whats-new-in-python\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/data-flair.training\/blogs\/whats-new-in-python\/#primaryimage","url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/whats-new-in-python-3.8.jpg","contentUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/whats-new-in-python-3.8.jpg","width":802,"height":420,"caption":"whats new in python 3.8 - Python 3.8 Features"},{"@type":"BreadcrumbList","@id":"https:\/\/data-flair.training\/blogs\/whats-new-in-python\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Blog Home","item":"https:\/\/data-flair.training\/blogs\/"},{"@type":"ListItem","position":2,"name":"Python Tutorials","item":"https:\/\/data-flair.training\/blogs\/category\/python\/"},{"@type":"ListItem","position":3,"name":"What&#8217;s new in Python 3.8? &#8211; Unveiling the Latest Features of Python"}]},{"@type":"WebSite","@id":"https:\/\/data-flair.training\/blogs\/#website","url":"https:\/\/data-flair.training\/blogs\/","name":"DataFlair","description":"Learn Today. Lead Tomorrow.","publisher":{"@id":"https:\/\/data-flair.training\/blogs\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/data-flair.training\/blogs\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/data-flair.training\/blogs\/#organization","name":"DataFlair","url":"https:\/\/data-flair.training\/blogs\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/logo\/image\/","url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2016\/07\/Data-Flair.png","contentUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2016\/07\/Data-Flair.png","width":106,"height":48,"caption":"DataFlair"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/DataFlairWS\/","https:\/\/x.com\/DataFlairWS","https:\/\/www.linkedin.com\/company\/dataflair-web-services-pvt-ltd\/","https:\/\/www.youtube.com\/user\/DataFlairWS"]},{"@type":"Person","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/person\/beb0cab24b7aa54423a3b50e669a9dcd","name":"DataFlair Team","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/c322416204232f4dd97ef3901b0a499a5d34d7ba7fe333f4bfe53a907873d293?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/c322416204232f4dd97ef3901b0a499a5d34d7ba7fe333f4bfe53a907873d293?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/c322416204232f4dd97ef3901b0a499a5d34d7ba7fe333f4bfe53a907873d293?s=96&d=mm&r=g","caption":"DataFlair Team"},"description":"DataFlair Team specializes in creating clear, actionable content on programming, Java, Python, C++, DSA, AI, ML, data Science, Android, Flutter, MERN, Web Development, and technology. Backed by industry expertise, we make learning easy and career-oriented for beginners and pros alike.","url":"https:\/\/data-flair.training\/blogs\/author\/dfteam3\/"}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/71328","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/users\/7"}],"replies":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/comments?post=71328"}],"version-history":[{"count":11,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/71328\/revisions"}],"predecessor-version":[{"id":147884,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/71328\/revisions\/147884"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/media\/71338"}],"wp:attachment":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/media?parent=71328"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/categories?post=71328"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/tags?post=71328"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}