It's on fire! Python 3.9 Eight New Feature Maps made by 16-year-old high school students
Public concern "Python meets machine learning”
Python3.9, "A thousand calls come out."
Take a quick look at the focus of this release.
New.Grammar features:
PEP 584, adding a close to the dictand operators.
PEP 585, generic for types in multiple standard collections.
PEP 614, relax the grammar restrictions on decorators.
New.Built-in features:
PEP 616, the string method for removing prefixes and suffixes.
New.Features in the standard library:
PEP 593, flexible function and variable labeling.
Added os.pidfd_open() to allow process management without competition and signals.
InterpreterImprovements:
PEP 573, a method from the C extension type to quickly access the module state.
PEP 617, CPython now uses a new PEG-based parser.
……
New.Library module:
PEP 615, the IANA time zone database is now included in the zoneinfo module of the standard library.
The topological sort implementation of the graph is now available by the new graphlib module.
To better understand the update, a 16-year-old was posted on TwitterPratham PrasoonAnd I made one available"Python 3.9 New Features Must Know"。
lists what he thinks is more importantEight new features, widely praised by netizens.
1, dictionary merge and update operators
The."Dictionary Merge and Update Operators"The new feature is a highlight of Python 3.9.
The merge(') merge with the update (') operator has been added to the built-in dict class, expanding the existing dict.update and the dictionary merge method of the dictionary.
The corresponding example is also shown in the diagram provided by Prasoon, as shown in the following image:
2, added to remove the prefixand the string method of the suffix
New use is also highlighted in Python's official documentation, as well as In Prasoon's charts"Strings to remove prefixes and suffixes"Method.
sr.removeprefix and str.removesuffix can easily remove unwanted prefixes or suffixes from strings:
3, more standardsThe type label generics in the item set
In.Type labelInstead of importing the corresponding capital type name from typing, you can now use the built-in multiple set types, such as list and dict, as generic types.
4、__importThe attribute is modified
__import__ () now raises ImportError instead of ValueError.
As for the reason, there is an explanation in Python's official documentation that the latter once occurred when the package was relatively imported beyond its highest level.
5, newmodule
In terms of new modules,Zoneinfo moduleIntroduced for the standard library IANA time zone database。
This is an entity datetime.tzinfo implementation based on system time zone data, as shown in the following illustration.
6, improved moldBlock.
In addition to the new modules, Python 3.9 has made improvements to some of the original modules.
Prasoon cites one that he thinks is more importantRandom。
It's called Random. Random.randbytes method can be used to generate random byte strings, as shown in the following illustration.
Besides, there arecancel_futures。
Python 3.9 adds a new cancel_futures-shaped ginseng to the concurrent.futures.Executor.shutdown(), which cancels all pending Futures that have not yet started running without waiting for them to finish running before shutting down the executor.
Of course, in addition to these eight new features, Python's official documentation lists the update in more detail.
Interested readers can poke the end-of-article link to get a deeper understanding.
About the workof the
Pratham Prasoon, a 16-year-old Indian high school student with a passion for finance and a curiosity about the world of programming, describes himself as a science geek.
As a programmer, he considers himself a "tool amm knows" type player, that is, instead of being the only programming language used, he makes choices for his own purposes.
He is currently studying Real, Flask, Django and Tensorflow.
RELATED LINKS http://www.scots
https://docs.python.org/zh-cn/3.9/whatsnew/3.9.html
https://twitter.com/PrasoonPratham/status/1313392420038483968、
Heavy!
Python meets machine learningThe communication group has been set up!
Extra bonus resources! Qiu Xipeng Deep Learning and Neural Networks, pytorch Official Chinese Tutorial, 20 welfare resources using Python for data analysis, machine learning notes, pandas official document Chinese, Chinese, etc How to get: After entering the groupClick on the group announcement to pick up the download link
Note: Please modify the note as you add it
(School/Company, Name, Direction)
For example - Hagong University, Zhang San, dialogue system.
Lord, micro-business and other advertising please consciously bypass. Thank you!
Recommended reading
• 10 Principles for Maintaining Efficient Paper Writing!
• It's worth collecting! 6 great online tool collections
• It's super useful! 5 completely free, platform-wide note-taking software
• One-hot encoding is not 10-50s, and you deserve these classification variable encoding methods
• Algorithmic engineers must know that there will be 10 basic algorithms!
• Recommended! 10 things to know about learning data science
• The most complete overview list in the field of machine learning!
Go to "Discovery" - "Take a look" browse "Friends are watching"