- Daniel Arbuckle's Mastering Python
- Daniel Arbuckle
- 342字
- 2021-07-02 21:09:33
The changes in the syntactic
Since version 3.5, Python has three new groups of syntactic editions. The first of these groups is the introduction of keywords for describing coroutines. Python already supported coroutines, but the keywords make things clear and sometimes simpler. We'll be discussing coroutines in depth in a later chapter, so we won't go into this any further now.
The second piece of the new syntax is the introduction of the @ symbol as an infix binary operator. This means that placing an @ symbol between two sub-expressions is now a valid Python expression, just like placing a + symbol between the sub-expressions would be as shown in the following screenshot:

However, since no built-in data type supports the @ symbol operator yet, we won't be finding much use for it in this book. The intended semantic meaning of the @ symbol is that it should represent matrix multiplication and it was added to improve support for an interoperability between third-party packages that implement matrixes and matrix operations.
The third piece of new syntax is an expansion of Python's pre-existing syntax for using lists and dictionaries to provide the parameter values when invoking a function.
Before, it was possible to put an asterisk (*) before a list of values to indicate that those values should be assigned to the parameters in the same order that they appeared in the list. Here is the code example for a single asterisk:

Similarly, * before two values was used to indicate that the values in a dictionary with text string keys should be assigned to the function's parameters by name, as shown here:

The new syntax is just that we can now use more than one list or dictionary in this way, and that we can use the same asterisk and double asterisk syntax for constructing tuples, lists, dictionaries, and sets.
We mentioned earlier that while Python attaches data types to data values rather than variables, it is possible to use function annotations to describe the expected types of function parameters' return values.
- C#高級編程(第10版) C# 6 & .NET Core 1.0 (.NET開發(fā)經(jīng)典名著)
- LabVIEW入門與實戰(zhàn)開發(fā)100例
- PostgreSQL 11從入門到精通(視頻教學版)
- 零基礎學Java程序設計
- Mastering ServiceNow(Second Edition)
- Android Native Development Kit Cookbook
- 劍指Java:核心原理與應用實踐
- Using Yocto Project with BeagleBone Black
- FusionCharts Beginner’s Guide:The Official Guide for FusionCharts Suite
- Java Web應用開發(fā)
- Selenium Essentials
- Python程序設計
- SAP HANA Cookbook
- Java Web開發(fā)任務教程
- 微信公眾平臺服務號開發(fā):揭秘九大高級接口