SlideShare a Scribd company logo
http://axonmatics.com
http://axonmatics.com
New Features of Python 3.10
Dr. Gábor Guta
http://axonmatics.com
http://axonmatics.com
About me
- I develop software in Python roughly for 15 years and I train/consult
Python developers for 8 years
- I did research on formally specifying programming languages, prove
correctness of software systems, and building compilers
- I worked mainly on bio-/cheminformatic software development and
this topic also generally interests me (I have degree on medicine
development too)
Copyright (C) 2022 Dr. Guta Gábor
http://axonmatics.com
http://axonmatics.com
Agenda
- What usually included in a new minor version of Python?
- Python 3.10
- Patterns matching statement (PEP634)
- Enabling parentheses usage in with statement
- Python 3.9
- Union operator on dictionary data type
- Thoughts on the development of the Python language
Copyright (C) 2022 Dr. Guta Gábor
http://axonmatics.com
What is included in new release?
3.10 Release note
Source: https://docs.python.org/3/whatsnew/3.10.html
Copyright (C) 2022 Dr. Guta Gábor
http://axonmatics.com
http://axonmatics.com
PEP634 - base structure
a_num = int(input("Specify a number between 1 and 10:"))
match a_num:
case 1:
print('The smallest number')
case 2:
print('The first even number')
case 4|6|8|10:
print('An even number')
case _:
print('Out of range')
Copyright (C) 2022 Dr. Guta Gábor
http://axonmatics.com
http://axonmatics.com
PEP634 - variables and guard conditions
a_num = int(input("Specify a number between 1 and 10:"))
match a_num:
case 1:
print('The smallest number')
case x if x % 2 == 0:
print(f'{x} is an even number')
case x if x % 2 == 1:
print(f'{x} is an odd number')
Copyright (C) 2022 Dr. Guta Gábor
http://axonmatics.com
http://axonmatics.com
PEP634 - matching objects
class Duck:
__match_args__ = ("name",
"sound")
def __init__(self,
name,
sound):
self.name = name
self.sound = sound
def quack(self):
print(self.sound)
k = Duck('Donald', 'quaaaack')
k.name = input('Its name?')
k.sound = input('What does it say?')
match k:
case Duck('Duck', sound):
print('Please, provide a ' +
'name for the duck?')
case Duck(name, sound):
print(f'{name} says {sound}')
Copyright (C) 2022 Dr. Guta Gábor
http://axonmatics.com
http://axonmatics.com
PEP634 - matching lists and dictionaries
k = ['Donald', 'Quack']
k[0] = input('Its name?')
k[1] = ('What does it say?')
match k:
case ['Duck', sound]:
print('Please, provide ' +
'a name for the duck?')
case [name, sound]:
print(f'{name} says ' +
f'{sound}')
k = {'name': 'Donald',
'sound': 'Quack'}
k['name'] = input('Its name?')
k['sound'] = ('What does it say?')
match k:
case {'name': 'Duck',
'sound': sound}:
print('Please, provide ' +
'a name for the duck?')
case {'name': name,
'sound': sound}:
print(f'{name} says {sound}')
Copyright (C) 2022 Dr. Guta Gábor
http://axonmatics.com
http://axonmatics.com
Parentheses in the with statement
with (open("memoir_of_the_duck.txt") as meomir,
open("manifesto_of_the_duck.txt") as mani):
print(memoir.read())
print(mani.read())
Copyright (C) 2020 Dr.Guta Gábor
http://axonmatics.com
http://axonmatics.com
Union operator usage on dictionaries
animals_outside = {'Muu': 'cow', 'Roff': 'pig'}
animals_inside = {'Quaa': 'duck',
'Muu': 'raving duck'}
all_animals = animals_outside | animals_inside
all_animals_2 = dict(animals_inside)
all_animals_2 |= animals_outside
assert all_animals != all_animals_2
Copyright (C) 2020 Dr.Guta Gábor
http://axonmatics.com
http://axonmatics.com
Release cycles
• Currently, there is a new version in every year
• Security fixes provided up to 5 years and
1.5 years is the general support cycle
• My personal experience is that approx. 0.5-1 year
is needed to new version become widely adapted
(e.g. Anaconda, AWS lambda, etc.)
• See PEP602 for further details
Verzió Kiadási dátum
3.0 2008/12
3.1 2009/06
2.7 2010/07
3.2 2011/02
... ...
3.7 2018/06
3.8 2019/10
3.9 2020/10
3.10 2021/10
3.11 2022/10
Copyright (C) 2022 Dr. Guta Gábor
http://axonmatics.com
Development of the Python language
● Within 5-8 years needed for new language element to completely change
or to become fully accepted:
○ Asynchronous language constructs:
generator-based coroutine vs. native coroutine
○ Type annotations (type hints)
● Regular small changes
○ Walrus operator in version 3.8 (:=)
● Important internal changes
○ New PEG (Parsing Expression Grammar) parser in version 3.9
Copyright (C) 2022 Dr. Guta Gábor
http://axonmatics.com
Version Changes of the asynchronous language constructs
3.4 • PEP 3156, a new "asyncio" module, a new framework for asynchronous I/O
3.5 • PEP 492, coroutines with async and await syntax
3.6 • PEP 525, Asynchronous Generators (provisional)
• PEP 530, Asynchronous Comprehensions
3.7 • Backwards incompatible syntax changes: async and await are now reserved keywords.
• The asyncio module has received new features, significant usability and performance improvements.
3.8 • asyncio.run() has graduated from the provisional to stable API.
• Running python -m asyncio launches a natively async REPL.
• Several other changes in asyncio package
3.9 • Parallel running of aclose() / asend() / athrow() is now prohibited, and ag_running now reflects the actual
running status of the async generator. (Contributed by Yury Selivanov in bpo-30773.)
• Several other changes in asyncio package
3.10 • Two new builtin functions – aiter() and anext() have been added to provide asynchronous counterparts to
iter() and next(), respectively. (Contributed by Joshua Bronson, Daniel Pope, and Justin Wang in
bpo-31861.)
Copyright (C) 2022 Dr. Guta Gábor

More Related Content

Similar to New Features of Python 3.10

Scientist meets web dev: how Python became the language of data
Scientist meets web dev: how Python became the language of dataScientist meets web dev: how Python became the language of data
Scientist meets web dev: how Python became the language of dataGael Varoquaux
 
Inroduction to golang
Inroduction to golangInroduction to golang
Inroduction to golangYoni Davidson
 
The Ring programming language version 1.7 book - Part 89 of 196
The Ring programming language version 1.7 book - Part 89 of 196The Ring programming language version 1.7 book - Part 89 of 196
The Ring programming language version 1.7 book - Part 89 of 196Mahmoud Samir Fayed
 
Enroller Colloquium: Sulman Sarwar
Enroller Colloquium: Sulman SarwarEnroller Colloquium: Sulman Sarwar
Enroller Colloquium: Sulman SarwarJohanna Green
 
Adaptive podcasting 2022 for Bristol+Bath
Adaptive podcasting 2022 for Bristol+BathAdaptive podcasting 2022 for Bristol+Bath
Adaptive podcasting 2022 for Bristol+BathIan Forrester
 
Massively Parallel Process with Prodedural Python by Ian Huston
Massively Parallel Process with Prodedural Python by Ian HustonMassively Parallel Process with Prodedural Python by Ian Huston
Massively Parallel Process with Prodedural Python by Ian HustonPyData
 
What is the best full text search engine for Python?
What is the best full text search engine for Python?What is the best full text search engine for Python?
What is the best full text search engine for Python?Andrii Soldatenko
 
Massively Parallel Processing with Procedural Python by Ronert Obst PyData Be...
Massively Parallel Processing with Procedural Python by Ronert Obst PyData Be...Massively Parallel Processing with Procedural Python by Ronert Obst PyData Be...
Massively Parallel Processing with Procedural Python by Ronert Obst PyData Be...PyData
 
Using Flow-based programming to write tools and workflows for Scientific Comp...
Using Flow-based programming to write tools and workflows for Scientific Comp...Using Flow-based programming to write tools and workflows for Scientific Comp...
Using Flow-based programming to write tools and workflows for Scientific Comp...Samuel Lampa
 
Clouds are Not Free: Guide to Observability-Driven Efficiency Optimizations
Clouds are Not Free: Guide to Observability-Driven Efficiency OptimizationsClouds are Not Free: Guide to Observability-Driven Efficiency Optimizations
Clouds are Not Free: Guide to Observability-Driven Efficiency OptimizationsScyllaDB
 
Python-nose: A unittest-based testing framework for Python that makes writing...
Python-nose: A unittest-based testing framework for Python that makes writing...Python-nose: A unittest-based testing framework for Python that makes writing...
Python-nose: A unittest-based testing framework for Python that makes writing...Timo Stollenwerk
 
Certified Reasoning for Automated Verification
Certified Reasoning for Automated VerificationCertified Reasoning for Automated Verification
Certified Reasoning for Automated VerificationAsankhaya Sharma
 
The Ring programming language version 1.3 book - Part 8 of 88
The Ring programming language version 1.3 book - Part 8 of 88The Ring programming language version 1.3 book - Part 8 of 88
The Ring programming language version 1.3 book - Part 8 of 88Mahmoud Samir Fayed
 
The Ring programming language version 1.9 book - Part 22 of 210
The Ring programming language version 1.9 book - Part 22 of 210The Ring programming language version 1.9 book - Part 22 of 210
The Ring programming language version 1.9 book - Part 22 of 210Mahmoud Samir Fayed
 
RESTful API Development using Go
RESTful API Development using GoRESTful API Development using Go
RESTful API Development using GoBaiju Muthukadan
 
Cock Biopython Bosc2009
Cock Biopython Bosc2009Cock Biopython Bosc2009
Cock Biopython Bosc2009bosc
 
Dev8d 2011-pipe2 py
Dev8d 2011-pipe2 pyDev8d 2011-pipe2 py
Dev8d 2011-pipe2 pyTony Hirst
 
Learning to Generate Pseudo-code from Source Code using Statistical Machine T...
Learning to Generate Pseudo-code from Source Code using Statistical Machine T...Learning to Generate Pseudo-code from Source Code using Statistical Machine T...
Learning to Generate Pseudo-code from Source Code using Statistical Machine T...Yusuke Oda
 

Similar to New Features of Python 3.10 (20)

Scientist meets web dev: how Python became the language of data
Scientist meets web dev: how Python became the language of dataScientist meets web dev: how Python became the language of data
Scientist meets web dev: how Python became the language of data
 
Inroduction to golang
Inroduction to golangInroduction to golang
Inroduction to golang
 
The Ring programming language version 1.7 book - Part 89 of 196
The Ring programming language version 1.7 book - Part 89 of 196The Ring programming language version 1.7 book - Part 89 of 196
The Ring programming language version 1.7 book - Part 89 of 196
 
Enroller Colloquium: Sulman Sarwar
Enroller Colloquium: Sulman SarwarEnroller Colloquium: Sulman Sarwar
Enroller Colloquium: Sulman Sarwar
 
Adaptive podcasting 2022 for Bristol+Bath
Adaptive podcasting 2022 for Bristol+BathAdaptive podcasting 2022 for Bristol+Bath
Adaptive podcasting 2022 for Bristol+Bath
 
Massively Parallel Process with Prodedural Python by Ian Huston
Massively Parallel Process with Prodedural Python by Ian HustonMassively Parallel Process with Prodedural Python by Ian Huston
Massively Parallel Process with Prodedural Python by Ian Huston
 
What is the best full text search engine for Python?
What is the best full text search engine for Python?What is the best full text search engine for Python?
What is the best full text search engine for Python?
 
Massively Parallel Processing with Procedural Python by Ronert Obst PyData Be...
Massively Parallel Processing with Procedural Python by Ronert Obst PyData Be...Massively Parallel Processing with Procedural Python by Ronert Obst PyData Be...
Massively Parallel Processing with Procedural Python by Ronert Obst PyData Be...
 
Using Flow-based programming to write tools and workflows for Scientific Comp...
Using Flow-based programming to write tools and workflows for Scientific Comp...Using Flow-based programming to write tools and workflows for Scientific Comp...
Using Flow-based programming to write tools and workflows for Scientific Comp...
 
Pyhton-1a-Basics.pdf
Pyhton-1a-Basics.pdfPyhton-1a-Basics.pdf
Pyhton-1a-Basics.pdf
 
Clouds are Not Free: Guide to Observability-Driven Efficiency Optimizations
Clouds are Not Free: Guide to Observability-Driven Efficiency OptimizationsClouds are Not Free: Guide to Observability-Driven Efficiency Optimizations
Clouds are Not Free: Guide to Observability-Driven Efficiency Optimizations
 
Python-nose: A unittest-based testing framework for Python that makes writing...
Python-nose: A unittest-based testing framework for Python that makes writing...Python-nose: A unittest-based testing framework for Python that makes writing...
Python-nose: A unittest-based testing framework for Python that makes writing...
 
Certified Reasoning for Automated Verification
Certified Reasoning for Automated VerificationCertified Reasoning for Automated Verification
Certified Reasoning for Automated Verification
 
The Ring programming language version 1.3 book - Part 8 of 88
The Ring programming language version 1.3 book - Part 8 of 88The Ring programming language version 1.3 book - Part 8 of 88
The Ring programming language version 1.3 book - Part 8 of 88
 
The Ring programming language version 1.9 book - Part 22 of 210
The Ring programming language version 1.9 book - Part 22 of 210The Ring programming language version 1.9 book - Part 22 of 210
The Ring programming language version 1.9 book - Part 22 of 210
 
Mashing Up The Guardian
Mashing Up The GuardianMashing Up The Guardian
Mashing Up The Guardian
 
RESTful API Development using Go
RESTful API Development using GoRESTful API Development using Go
RESTful API Development using Go
 
Cock Biopython Bosc2009
Cock Biopython Bosc2009Cock Biopython Bosc2009
Cock Biopython Bosc2009
 
Dev8d 2011-pipe2 py
Dev8d 2011-pipe2 pyDev8d 2011-pipe2 py
Dev8d 2011-pipe2 py
 
Learning to Generate Pseudo-code from Source Code using Statistical Machine T...
Learning to Generate Pseudo-code from Source Code using Statistical Machine T...Learning to Generate Pseudo-code from Source Code using Statistical Machine T...
Learning to Generate Pseudo-code from Source Code using Statistical Machine T...
 

More from Gabor Guta

Agilie Development with UML
Agilie Development with UMLAgilie Development with UML
Agilie Development with UMLGabor Guta
 
A Lightweight MDD Process Applied in Small Projects
A Lightweight MDD Process Applied in Small ProjectsA Lightweight MDD Process Applied in Small Projects
A Lightweight MDD Process Applied in Small ProjectsGabor Guta
 
How can be the quality of a software product measured?
How can be the quality of a software product measured?How can be the quality of a software product measured?
How can be the quality of a software product measured?Gabor Guta
 
Challenges of Developing BLE Application on Android
Challenges of Developing BLE Application on AndroidChallenges of Developing BLE Application on Android
Challenges of Developing BLE Application on AndroidGabor Guta
 
CPS Demo System
CPS Demo SystemCPS Demo System
CPS Demo SystemGabor Guta
 
LEGO Demo System for CPS Education
LEGO Demo System for CPS EducationLEGO Demo System for CPS Education
LEGO Demo System for CPS EducationGabor Guta
 

More from Gabor Guta (6)

Agilie Development with UML
Agilie Development with UMLAgilie Development with UML
Agilie Development with UML
 
A Lightweight MDD Process Applied in Small Projects
A Lightweight MDD Process Applied in Small ProjectsA Lightweight MDD Process Applied in Small Projects
A Lightweight MDD Process Applied in Small Projects
 
How can be the quality of a software product measured?
How can be the quality of a software product measured?How can be the quality of a software product measured?
How can be the quality of a software product measured?
 
Challenges of Developing BLE Application on Android
Challenges of Developing BLE Application on AndroidChallenges of Developing BLE Application on Android
Challenges of Developing BLE Application on Android
 
CPS Demo System
CPS Demo SystemCPS Demo System
CPS Demo System
 
LEGO Demo System for CPS Education
LEGO Demo System for CPS EducationLEGO Demo System for CPS Education
LEGO Demo System for CPS Education
 

Recently uploaded

Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...Shahin Sheidaei
 
Multiple Your Crypto Portfolio with the Innovative Features of Advanced Crypt...
Multiple Your Crypto Portfolio with the Innovative Features of Advanced Crypt...Multiple Your Crypto Portfolio with the Innovative Features of Advanced Crypt...
Multiple Your Crypto Portfolio with the Innovative Features of Advanced Crypt...Hivelance Technology
 
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...Anthony Dahanne
 
Using IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New ZealandUsing IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New ZealandIES VE
 
How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?
How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?
How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?XfilesPro
 
Designing for Privacy in Amazon Web Services
Designing for Privacy in Amazon Web ServicesDesigning for Privacy in Amazon Web Services
Designing for Privacy in Amazon Web ServicesKrzysztofKkol1
 
Software Testing Exam imp Ques Notes.pdf
Software Testing Exam imp Ques Notes.pdfSoftware Testing Exam imp Ques Notes.pdf
Software Testing Exam imp Ques Notes.pdfMayankTawar1
 
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERRORTROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERRORTier1 app
 
Into the Box 2024 - Keynote Day 2 Slides.pdf
Into the Box 2024 - Keynote Day 2 Slides.pdfInto the Box 2024 - Keynote Day 2 Slides.pdf
Into the Box 2024 - Keynote Day 2 Slides.pdfOrtus Solutions, Corp
 
How Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptxHow Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptxwottaspaceseo
 
First Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User EndpointsFirst Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User EndpointsGlobus
 
2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptxGeorgi Kodinov
 
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdfDominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdfAMB-Review
 
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...Juraj Vysvader
 
Understanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSageUnderstanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSageGlobus
 
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...Globus
 
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...Globus
 
BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024Ortus Solutions, Corp
 
Advanced Flow Concepts Every Developer Should Know
Advanced Flow Concepts Every Developer Should KnowAdvanced Flow Concepts Every Developer Should Know
Advanced Flow Concepts Every Developer Should KnowPeter Caitens
 
Vitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume MontevideoVitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume MontevideoVitthal Shirke
 

Recently uploaded (20)

Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
 
Multiple Your Crypto Portfolio with the Innovative Features of Advanced Crypt...
Multiple Your Crypto Portfolio with the Innovative Features of Advanced Crypt...Multiple Your Crypto Portfolio with the Innovative Features of Advanced Crypt...
Multiple Your Crypto Portfolio with the Innovative Features of Advanced Crypt...
 
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
 
Using IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New ZealandUsing IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New Zealand
 
How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?
How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?
How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?
 
Designing for Privacy in Amazon Web Services
Designing for Privacy in Amazon Web ServicesDesigning for Privacy in Amazon Web Services
Designing for Privacy in Amazon Web Services
 
Software Testing Exam imp Ques Notes.pdf
Software Testing Exam imp Ques Notes.pdfSoftware Testing Exam imp Ques Notes.pdf
Software Testing Exam imp Ques Notes.pdf
 
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERRORTROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
 
Into the Box 2024 - Keynote Day 2 Slides.pdf
Into the Box 2024 - Keynote Day 2 Slides.pdfInto the Box 2024 - Keynote Day 2 Slides.pdf
Into the Box 2024 - Keynote Day 2 Slides.pdf
 
How Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptxHow Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptx
 
First Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User EndpointsFirst Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User Endpoints
 
2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx
 
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdfDominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
 
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
 
Understanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSageUnderstanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSage
 
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
 
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
 
BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024
 
Advanced Flow Concepts Every Developer Should Know
Advanced Flow Concepts Every Developer Should KnowAdvanced Flow Concepts Every Developer Should Know
Advanced Flow Concepts Every Developer Should Know
 
Vitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume MontevideoVitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume Montevideo
 

New Features of Python 3.10

  • 2. http://axonmatics.com http://axonmatics.com About me - I develop software in Python roughly for 15 years and I train/consult Python developers for 8 years - I did research on formally specifying programming languages, prove correctness of software systems, and building compilers - I worked mainly on bio-/cheminformatic software development and this topic also generally interests me (I have degree on medicine development too) Copyright (C) 2022 Dr. Guta Gábor
  • 3. http://axonmatics.com http://axonmatics.com Agenda - What usually included in a new minor version of Python? - Python 3.10 - Patterns matching statement (PEP634) - Enabling parentheses usage in with statement - Python 3.9 - Union operator on dictionary data type - Thoughts on the development of the Python language Copyright (C) 2022 Dr. Guta Gábor
  • 4. http://axonmatics.com What is included in new release? 3.10 Release note Source: https://docs.python.org/3/whatsnew/3.10.html Copyright (C) 2022 Dr. Guta Gábor
  • 5. http://axonmatics.com http://axonmatics.com PEP634 - base structure a_num = int(input("Specify a number between 1 and 10:")) match a_num: case 1: print('The smallest number') case 2: print('The first even number') case 4|6|8|10: print('An even number') case _: print('Out of range') Copyright (C) 2022 Dr. Guta Gábor
  • 6. http://axonmatics.com http://axonmatics.com PEP634 - variables and guard conditions a_num = int(input("Specify a number between 1 and 10:")) match a_num: case 1: print('The smallest number') case x if x % 2 == 0: print(f'{x} is an even number') case x if x % 2 == 1: print(f'{x} is an odd number') Copyright (C) 2022 Dr. Guta Gábor
  • 7. http://axonmatics.com http://axonmatics.com PEP634 - matching objects class Duck: __match_args__ = ("name", "sound") def __init__(self, name, sound): self.name = name self.sound = sound def quack(self): print(self.sound) k = Duck('Donald', 'quaaaack') k.name = input('Its name?') k.sound = input('What does it say?') match k: case Duck('Duck', sound): print('Please, provide a ' + 'name for the duck?') case Duck(name, sound): print(f'{name} says {sound}') Copyright (C) 2022 Dr. Guta Gábor
  • 8. http://axonmatics.com http://axonmatics.com PEP634 - matching lists and dictionaries k = ['Donald', 'Quack'] k[0] = input('Its name?') k[1] = ('What does it say?') match k: case ['Duck', sound]: print('Please, provide ' + 'a name for the duck?') case [name, sound]: print(f'{name} says ' + f'{sound}') k = {'name': 'Donald', 'sound': 'Quack'} k['name'] = input('Its name?') k['sound'] = ('What does it say?') match k: case {'name': 'Duck', 'sound': sound}: print('Please, provide ' + 'a name for the duck?') case {'name': name, 'sound': sound}: print(f'{name} says {sound}') Copyright (C) 2022 Dr. Guta Gábor
  • 9. http://axonmatics.com http://axonmatics.com Parentheses in the with statement with (open("memoir_of_the_duck.txt") as meomir, open("manifesto_of_the_duck.txt") as mani): print(memoir.read()) print(mani.read()) Copyright (C) 2020 Dr.Guta Gábor
  • 10. http://axonmatics.com http://axonmatics.com Union operator usage on dictionaries animals_outside = {'Muu': 'cow', 'Roff': 'pig'} animals_inside = {'Quaa': 'duck', 'Muu': 'raving duck'} all_animals = animals_outside | animals_inside all_animals_2 = dict(animals_inside) all_animals_2 |= animals_outside assert all_animals != all_animals_2 Copyright (C) 2020 Dr.Guta Gábor
  • 11. http://axonmatics.com http://axonmatics.com Release cycles • Currently, there is a new version in every year • Security fixes provided up to 5 years and 1.5 years is the general support cycle • My personal experience is that approx. 0.5-1 year is needed to new version become widely adapted (e.g. Anaconda, AWS lambda, etc.) • See PEP602 for further details Verzió Kiadási dátum 3.0 2008/12 3.1 2009/06 2.7 2010/07 3.2 2011/02 ... ... 3.7 2018/06 3.8 2019/10 3.9 2020/10 3.10 2021/10 3.11 2022/10 Copyright (C) 2022 Dr. Guta Gábor
  • 12. http://axonmatics.com Development of the Python language ● Within 5-8 years needed for new language element to completely change or to become fully accepted: ○ Asynchronous language constructs: generator-based coroutine vs. native coroutine ○ Type annotations (type hints) ● Regular small changes ○ Walrus operator in version 3.8 (:=) ● Important internal changes ○ New PEG (Parsing Expression Grammar) parser in version 3.9 Copyright (C) 2022 Dr. Guta Gábor
  • 13. http://axonmatics.com Version Changes of the asynchronous language constructs 3.4 • PEP 3156, a new "asyncio" module, a new framework for asynchronous I/O 3.5 • PEP 492, coroutines with async and await syntax 3.6 • PEP 525, Asynchronous Generators (provisional) • PEP 530, Asynchronous Comprehensions 3.7 • Backwards incompatible syntax changes: async and await are now reserved keywords. • The asyncio module has received new features, significant usability and performance improvements. 3.8 • asyncio.run() has graduated from the provisional to stable API. • Running python -m asyncio launches a natively async REPL. • Several other changes in asyncio package 3.9 • Parallel running of aclose() / asend() / athrow() is now prohibited, and ag_running now reflects the actual running status of the async generator. (Contributed by Yury Selivanov in bpo-30773.) • Several other changes in asyncio package 3.10 • Two new builtin functions – aiter() and anext() have been added to provide asynchronous counterparts to iter() and next(), respectively. (Contributed by Joshua Bronson, Daniel Pope, and Justin Wang in bpo-31861.) Copyright (C) 2022 Dr. Guta Gábor