SlideShare a Scribd company logo
1 of 13
Download to read offline
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

Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...kellynguyen01
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...panagenda
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfkalichargn70th171
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software DevelopersVinodh Ram
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsJhone kinadey
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsArshad QA
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfjoe51371421
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxbodapatigopi8531
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...harshavardhanraghave
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...MyIntelliSource, Inc.
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Modelsaagamshah0812
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerThousandEyes
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...OnePlan Solutions
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Steffen Staab
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providermohitmore19
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVshikhaohhpro
 

Recently uploaded (20)

Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software Developers
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdf
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptx
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
Exploring iOS App Development: Simplifying the Process
Exploring iOS App Development: Simplifying the ProcessExploring iOS App Development: Simplifying the Process
Exploring iOS App Development: Simplifying the Process
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 

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