Elevator Pitch
I will introduce the new syntax and functions between Python 2.4 and Python 3.6 in this talk. I will also compare the old style to the new style. You will learn the best practices for Python coding and how to perform refactoring your old Python code. You can look at the evolution of Python.
Description
I think we began to use Python in some production systems at 2.3 or 2.4. I think Python 2.4 had enough functionality to build any system. Many tools ware created and used.
Python 2.4 was released nearly 15 years ago. Since then Python has been steadily evolving. Although it is possible to create a system with only Python 2.4, it is necessary to know the latest Python trends in order to write code that is better, more maintainable, and more performance-oriented.
There are also features and grammar in the web knockout that are often overlooked, not only by new python users, but also by seasoned Python veterans. I will introduce those features and grammar that I think are important while comparing the grammar and functions incorporated in Python 2.4 and now.
Notes
For example:
The below same means code. Python2.4
f = open("filename.txt", "r")
data = f.read()
f.close()
Python2.6 +
with open("filename.txt", "r") as f:
data = f.read()
Python2.4
from datetime import date
print "Today: %s" % date.today()
Python 2.6 +
from datetime import date
print("Today: {}".format(date.today()))
Python3.6 +
from datetime import date
print(f"Today: {date.today()}")
## Target
- Who want to know the new syntax of Python
- Who want to learn the history of Python
Outline
- Self introduction (2min)
- The history of Python by release date (3min)
- Important changes in each versions between Python 2.4 and Python 3.6 (7min)
- Python 2.4
- Python 2.5
- Python 2.6
- Python 2.7
- Python 3.0
- Python 3.1
- Python 3.2
- Python 3.3
- Python 3.4
- Python 3.5
- Python 3.6
- To compare the old style with the new style for the syntax and the structure (15min)
- “”.join() vs “”.join([])
- import () Multi-line Imports
- list.sort vs sorted(list)
- Conditional Expressions
- with
- %s vs str.format vs f-string
- except Exception, e vs except Exception as e
- print statement vs print() function
- / vs //
- dict Comprehensions and more
- OrderedDict vs default dict
- enum
- @ operator
- os.listdir() vs os.scandir()
- yield from
- Coroutines with async and await syntax
- Asynchronous Generators
- pathlib
- secrets module
- Q&A (3min)