Share python 3.9

trantuonglover1

New member
## Python 3.9: Có gì mới?

Python 3.9 được phát hành vào ngày 5 tháng 10 năm 2020. Đây là bản phát hành chính mới nhất của ngôn ngữ lập trình Python và nó bao gồm một số tính năng và cải tiến mới.

### Các tính năng mới trong Python 3.9

Một số tính năng mới trong Python 3.9 bao gồm:

*** Trường hợp khớp trong chuỗi f **.Bây giờ bạn có thể sử dụng cú pháp `f-string` để định dạng chuỗi theo cách nhạy cảm trường hợp.Ví dụ: mã sau sẽ in chuỗi "Xin chào, thế giới!"Trong tất cả các chữ cái viết hoa:

`` `Python
in (f "Xin chào, thế giới!". Thượng ())
`` `

*** Hỗ trợ cải tiến cho các chú thích loại **.Python 3.9 bao gồm một số cải tiến cho hệ thống chú thích loại của nó, giúp việc viết và sử dụng các chú thích loại dễ dàng hơn.Ví dụ: bây giờ bạn có thể sử dụng các chú thích loại để chỉ định các giá trị mặc định cho các đối số chức năng.

`` `Python
def chào (tên: str = "thế giới") -> không có:
"" "In một lời chào đến tên đã cho." ""

print (f "Xin chào, {name}!")

chào ()
`` `

*** Mới `Toán tử Walrus` **.Toán tử `Walrus` (` == `) cho phép bạn gán một giá trị cho một biến trong cùng một biểu thức mà bạn sử dụng để khởi tạo nó.Ví dụ: mã sau gán giá trị của `10` cho biến` x` và sau đó in giá trị của `x`:

`` `Python
x: = 10
in (x)
`` `

*** Cải thiện hiệu suất **.Python 3.9 bao gồm một số cải tiến hiệu suất, giúp nó nhanh hơn các phiên bản trước của ngôn ngữ.Ví dụ: các cấu trúc dữ liệu `dict` và` set` hiện có hiệu quả hơn và mô -đun `gc` đã được cải thiện để giảm sử dụng bộ nhớ.

### Tài nguyên

* [Tài liệu Python 3.9] (3.12.0 Documentation)
* [Ghi chú phát hành Python 3.9] (https://www.python.org/doads/release/python-390/)
* [Hướng dẫn Python 3.9] (The Python Tutorial)

### hashtags

* #Python
* #python3
* #Python39
* #các tính năng mới
* #PythonImprovements
=======================================
## Python 3.9: What's New?

Python 3.9 was released on October 5, 2020. It is the latest major release of the Python programming language, and it includes a number of new features and improvements.

### New Features in Python 3.9

Some of the new features in Python 3.9 include:

* **Match case in f-strings**. You can now use the `f-string` syntax to format strings in a case-sensitive manner. For example, the following code will print the string "Hello, world!" in all uppercase letters:

```python
print(f"Hello, world!".upper())
```

* **Improved support for type annotations**. Python 3.9 includes a number of improvements to its type annotation system, making it easier to write and use type annotations. For example, you can now use type annotations to specify the default values for function arguments.

```python
def greet(name: str = "World") -> None:
"""Print a greeting to the given name."""

print(f"Hello, {name}!")

greet()
```

* **New `walrus` operator**. The `walrus` operator (`==`) allows you to assign a value to a variable in the same expression that you use to initialize it. For example, the following code assigns the value of `10` to the variable `x` and then prints the value of `x`:

```python
x := 10
print(x)
```

* **Improved performance**. Python 3.9 includes a number of performance improvements, making it faster than previous versions of the language. For example, the `dict` and `set` data structures are now more efficient, and the `gc` module has been improved to reduce memory usage.

### Resources

* [Python 3.9 Documentation](https://docs.python.org/3/)
* [Python 3.9 Release Notes](https://www.python.org/downloads/release/python-390/)
* [Python 3.9 Tutorial](https://docs.python.org/3/tutorial/index.html)

### Hashtags

* #Python
* #python3
* #Python39
* #NewFeatures
* #PythonImprovements
 
Join Telegram ToolsKiemTrieuDoGroup
Back
Top