
Znaczące zmiany wprowadzone w każdej wersji Pythona 3
koszotoroburFanatyk
26piorunówKażda z wersji Pythona wprowadzała wiele zmian i ulepszeń - poniżej subiektywnie selektywna lista najważniejszych zmian wprowadzonych do każdej większej wersji Pythona 3:
Python 3.0 (2008-12-03):
* print statement replaced with a print() function
* dict.iterkeys(), dict.iteritems(), and dict.itervalues() removed
* Python 2’s xrange() is Python 3’s range(); Python 2’s range() is no more
* Python 2’s str is Python 3’s bytes; Python 2’s unicode is Python 3’s str
* The default Python source encoding is now UTF-8
* urllib2 module split into urllib.request and urllib.error modules
* urlparse module renamed to urllib.parse
* urllib module split into urllib.parse, urllib.request, and urllib.error modules
Python 3.1 (2009-06-26):
* The fields in strings formatted with str.format() can now omit numbering in order to be automatically numbered, as in 'Sir {} of {}'.format('Gallahad', 'Camelot')
* round(x, n) now returns an integer if x is an integer
* collections module: Counter and OrderedDict added
Python 3.2 (2011-02-20)
* New modules: argparse, concurrent.futures, html, and sysconfig
* .pyc files are now stored in _pycache_/ directories
* datetime module: timezone added
Python 3.3 (2012-09-29)
* New modules: faulthandler, ipaddress, lzma, unittest.mock, and venv
* Support for implicit namespace packages (directories without an _init_.py) added
* datetime module: New datetime methods: timestamp(), strftime(), and astimezone()
Python 3.4 (2014-03-17)
* New modules: asyncio, ensurepip, enum, pathlib, selectors, statistics, and tracemalloc
* http.server command-line interface: --bind option added
Python 3.5 (2015-09-13)
* Coroutine functions (async def), awaitable objects (await and _await()), asynchronous iteration (async for, aiter(), and anext()), and asynchronous context managers (async with, aenter(), and aexit_()) added
Multiple and/or unpackings can now be used in a single function call
* New modules: typing and zipapp
* Various additions & improvements to the asyncio module
Python 3.6 (2016-12-23)
* Formatted string literals (“f-strings”)
* Variables can now be annotated by following the name of the variable with a colon and the annotation
* Underscores can now be used in numeric literals
* await and yield can now be used in the same function, thereby enabling asynchronous generators
* async for can now be used in list, set, & dict comprehensions and in generator expressions
* await expressions can now be used in any comprehension
*kwargs now preserves insertion order
* dicts are now implemented in such a way that they preserve insertion order
* Various additions & improvements to the asyncio module
Python 3.7 (2018-06-27)
* dicts are now guaranteed to preserve insertion order
* async and await are now reserved keywords
* New modules: contextvars, dataclasses, importlib.resources
Python 3.8 (2019-10-14)
* Assignment expressions: := (the “walrus operator”) can now be used to assign a value to a variable in the middle of an expression
* Function parameters can now be made positional-only by placing a / after them in the argument list
Python 3.9 (2020-10-05)
* dicts can now be merged & updated using the | and |= operators
* New modules: graphlib and zoneinfo
* asyncio module: to_thread() added
* Removed: asyncio.Task.current_task() and asyncio.Task.all_tasks() (deprecated since Python 3.7); use asyncio.current_task() and asyncio.all_tasks() instead
Python 3.10 (2021-10-04)
* Pattern matching with match/case syntax
* Common syntax errors now have better error messages
Python 3.11 (2022-10-03)
* Exception groups
* Traceback messages now highlight the exact expression that caused the error
* New modules: tomllib and wsgiref.types
Komentarze (12)
Najważniejszego brakuje: w końcu zaczęli tę kobyłę optymalizować, z wersji na wersję generalnie przyspiesza.
@sierzant_armii_12_malp - fakt - optymalizacje są zauważalne - migrowałem aplikację co codziennie obrabia podobne ilości danych z 3.9 na 3.11 i jest z 15% szybciej gdy infrastruktura i kod się nie zmieniły - widzę to na monitoringu.
Piękny wpis, nic nie rozumiem :upside_down_face:
@koszotorobur Ogólnie to odbiłem się na studiach od C a potem już C++ mnie dobił i nawet nie chodziłem na zajęcia bo to była czarna magia.
Teraz jak brat coś programuje to ogólnie rozumiem co do mnie mówi i kolejne kroki programu, wiem niby w którą stronę to idzie ale jakbym miał coś samemu napisać to umarł w butach.
@L4RU55O - mi się też kiedyś tak wydawało - po początkowych porażkach się zaparłem i okazało się, że to jest do ogarnięcia. Ale nie ma sensu nikogo przekonywać 😉
@GetBetterSoon w innym moim wpisie powiedział, że:
> Na pythoninstitute.org jest tez zacny kurs.
@koszotorobur Talentu nie mam do programowania ale będę miał co poczytać do snu. Dzięki.
@L4RU55O - oficjalna strona Pythona ma świetny tutorial po polsku: https://docs.python.org/pl/3/tutorial/index.html.
Oczywiście o wiele więcej jest materiałów po angielsku - jak na przykład ten całkiem przyjemny godzinny tutorial dla początkujących: https://youtu.be/kqtD5dpn9C8.
Python TutorialPython jest łatwym do nauki, wszechstronnym językiem programowania. Ma wydajne wysoko-poziomowe struktury danych i proste ale efektywne podejście do programowania zorientowanego obiektowo. Eleganck...Python documentation@koszotorobur spoko podsumowanie
@koszotorobur zazdro, no to mi tylko typing spadł z nieba, argparse jest w pytke, a tam gdzie chciałbym użyć async to na złość programy mam na windoze.
no i od biedy dataclasy ale to głownie przez typing.
a i OrderedDict to był w p2
@GetBetterSoon - większość (jak nie każda) z tych rzeczy znalazła się na powyższej liście dlatego, że pozytywnie wpłynęła na moją pracę z Pythonem.
Indywidualne strony What's New z podanymi wszystkimi najważniejszymi zmianami w głównych wersjach Pythona 3:
* Python 3.11: https://docs.python.org/3/whatsnew/3.11.html
* Python 3.10: https://docs.python.org/3/whatsnew/3.10.html
* Python 3.9: https://docs.python.org/3/whatsnew/3.9.html
* Python 3.8: https://docs.python.org/3/whatsnew/3.8.html
* Python 3.7: https://docs.python.org/3/whatsnew/3.7.html
* Python 3.6: https://docs.python.org/3/whatsnew/3.6.html
* Python 3.5: https://docs.python.org/3/whatsnew/3.5.html
* Python 3.4: https://docs.python.org/3/whatsnew/3.4.html
* Python 3.3: https://docs.python.org/3/whatsnew/3.3.html
* Python 3.2: https://docs.python.org/3/whatsnew/3.2.html
* Python 3.1: https://docs.python.org/3/whatsnew/3.1.html
* Python 3.0: https://docs.python.org/3/whatsnew/3.0.html
What’s New In Python 3.11Editor, Pablo Galindo Salgado,. This article explains the new features in Python 3.11, compared to 3.10. Python 3.11 was released on October 24, 2022. For full details, see the changelog. Summary –...Python documentationDo Pythona 3.10 i 3.11 są oficjalne grafiki z największymi zmianami wprowadzonymi w tych wersjach.