Hướng dẫn python 3.6 to 3.9 migration - di chuyển python 3.6 sang 3.9

Phóng thích

3.11.0

Ngày

Ngày 17 tháng 11 năm 2022

Biên tập viên

Łukasz Langa

Bài viết này giải thích các tính năng mới trong Python 3.9, so với 3,8. Python 3.9 được phát hành vào ngày 5 tháng 10 năm 2020.

Để biết chi tiết đầy đủ, xem Changelog.changelog.

Xem thêm

PEP 596 - Lịch phát hành Python 3.9 - Python 3.9 Release Schedule

Tóm tắt - Phát hành Điểm nổi bật

Các tính năng cú pháp mới:

  • PEP 584, các nhà điều hành công đoàn được thêm vào dict;, union operators added to dict;

  • PEP 585, loại Generics Generics trong các bộ sưu tập tiêu chuẩn;, type hinting generics in standard collections;

  • PEP 614, hạn chế ngữ pháp thư giãn đối với các nhà trang trí., relaxed grammar restrictions on decorators.

Các tính năng tích hợp mới:

  • PEP 616, Phương thức chuỗi để loại bỏ các tiền tố và hậu tố., string methods to remove prefixes and suffixes.

Các tính năng mới trong thư viện tiêu chuẩn:

  • PEP 593, chức năng linh hoạt và chú thích thay đổi;, flexible function and variable annotations;

  • os.pidfd_open() thêm cho phép quản lý quy trình mà không cần chủng tộc và tín hiệu.

Cải thiện thông dịch viên:

  • PEP 573, truy cập nhanh vào trạng thái mô -đun từ các phương thức của các loại mở rộng C;, fast access to module state from methods of C extension types;

  • PEP 617, CPython hiện sử dụng trình phân tích cú pháp mới dựa trên PEG;, CPython now uses a new parser based on PEG;

  • Một số python tích hợp (phạm vi, tuple, set, frozenset, list, dict) hiện được tăng tốc bằng cách sử dụng PEP 590 VectorCall;PEP 590 vectorcall;

  • Bộ sưu tập rác không chặn các đối tượng được hồi sinh;

  • Một số mô -đun Python (____10,

    def greet_all(names: list[str]) -> None:
        for name in names:
            print("Hello", name)
    
    1,
    def greet_all(names: list[str]) -> None:
        for name in names:
            print("Hello", name)
    
    2,
    def greet_all(names: list[str]) -> None:
        for name in names:
            print("Hello", name)
    
    3,
    def greet_all(names: list[str]) -> None:
        for name in names:
            print("Hello", name)
    
    4,
    def greet_all(names: list[str]) -> None:
        for name in names:
            print("Hello", name)
    
    5,
    def greet_all(names: list[str]) -> None:
        for name in names:
            print("Hello", name)
    
    6,
    def greet_all(names: list[str]) -> None:
        for name in names:
            print("Hello", name)
    
    7,
    def greet_all(names: list[str]) -> None:
        for name in names:
            print("Hello", name)
    
    8,
    def greet_all(names: list[str]) -> None:
        for name in names:
            print("Hello", name)
    
    9,
    >>> from zoneinfo import ZoneInfo
    >>> from datetime import datetime, timedelta
    
    >>> # Daylight saving time
    >>> dt = datetime(2020, 10, 31, 12, tzinfo=ZoneInfo("America/Los_Angeles"))
    >>> print(dt)
    2020-10-31 12:00:00-07:00
    >>> dt.tzname()
    'PDT'
    
    >>> # Standard time
    >>> dt += timedelta(days=7)
    >>> print(dt)
    2020-11-07 12:00:00-08:00
    >>> print(dt.tzname())
    PST
    
    0

  • Một số mô -đun thư viện tiêu chuẩn (

    def greet_all(names: list[str]) -> None:
        for name in names:
            print("Hello", name)
    
    1,
    >>> from zoneinfo import ZoneInfo
    >>> from datetime import datetime, timedelta
    
    >>> # Daylight saving time
    >>> dt = datetime(2020, 10, 31, 12, tzinfo=ZoneInfo("America/Los_Angeles"))
    >>> print(dt)
    2020-10-31 12:00:00-07:00
    >>> dt.tzname()
    'PDT'
    
    >>> # Standard time
    >>> dt += timedelta(days=7)
    >>> print(dt)
    2020-11-07 12:00:00-08:00
    >>> print(dt.tzname())
    PST
    
    5,
    >>> from zoneinfo import ZoneInfo
    >>> from datetime import datetime, timedelta
    
    >>> # Daylight saving time
    >>> dt = datetime(2020, 10, 31, 12, tzinfo=ZoneInfo("America/Los_Angeles"))
    >>> print(dt)
    2020-10-31 12:00:00-07:00
    >>> dt.tzname()
    'PDT'
    
    >>> # Standard time
    >>> dt += timedelta(days=7)
    >>> print(dt)
    2020-11-07 12:00:00-08:00
    >>> print(dt.tzname())
    PST
    
    6,
    >>> from zoneinfo import ZoneInfo
    >>> from datetime import datetime, timedelta
    
    >>> # Daylight saving time
    >>> dt = datetime(2020, 10, 31, 12, tzinfo=ZoneInfo("America/Los_Angeles"))
    >>> print(dt)
    2020-10-31 12:00:00-07:00
    >>> dt.tzname()
    'PDT'
    
    >>> # Standard time
    >>> dt += timedelta(days=7)
    >>> print(dt)
    2020-11-07 12:00:00-08:00
    >>> print(dt.tzname())
    PST
    
    7,
    >>> from zoneinfo import ZoneInfo
    >>> from datetime import datetime, timedelta
    
    >>> # Daylight saving time
    >>> dt = datetime(2020, 10, 31, 12, tzinfo=ZoneInfo("America/Los_Angeles"))
    >>> print(dt)
    2020-10-31 12:00:00-07:00
    >>> dt.tzname()
    'PDT'
    
    >>> # Standard time
    >>> dt += timedelta(days=7)
    >>> print(dt)
    2020-11-07 12:00:00-08:00
    >>> print(dt.tzname())
    PST
    
    8,
    >>> from zoneinfo import ZoneInfo
    >>> from datetime import datetime, timedelta
    
    >>> # Daylight saving time
    >>> dt = datetime(2020, 10, 31, 12, tzinfo=ZoneInfo("America/Los_Angeles"))
    >>> print(dt)
    2020-10-31 12:00:00-07:00
    >>> dt.tzname()
    'PDT'
    
    >>> # Standard time
    >>> dt += timedelta(days=7)
    >>> print(dt)
    2020-11-07 12:00:00-08:00
    >>> print(dt.tzname())
    PST
    
    9,
    Python version                       3.4     3.5     3.6     3.7     3.8    3.9
    --------------                       ---     ---     ---     ---     ---    ---
    
    Variable and attribute read access:
        read_local                       7.1     7.1     5.4     5.1     3.9    3.9
        read_nonlocal                    7.1     8.1     5.8     5.4     4.4    4.5
        read_global                     15.5    19.0    14.3    13.6     7.6    7.8
        read_builtin                    21.1    21.6    18.5    19.0     7.5    7.8
        read_classvar_from_class        25.6    26.5    20.7    19.5    18.4   17.9
        read_classvar_from_instance     22.8    23.5    18.8    17.1    16.4   16.9
        read_instancevar                32.4    33.1    28.0    26.3    25.4   25.3
        read_instancevar_slots          27.8    31.3    20.8    20.8    20.2   20.5
        read_namedtuple                 73.8    57.5    45.0    46.8    18.4   18.7
        read_boundmethod                37.6    37.9    29.6    26.9    27.7   41.1
    
    Variable and attribute write access:
        write_local                      8.7     9.3     5.5     5.3     4.3    4.3
        write_nonlocal                  10.5    11.1     5.6     5.5     4.7    4.8
        write_global                    19.7    21.2    18.0    18.0    15.8   16.7
        write_classvar                  92.9    96.0   104.6   102.1    39.2   39.8
        write_instancevar               44.6    45.8    40.0    38.9    35.5   37.4
        write_instancevar_slots         35.6    36.1    27.3    26.6    25.7   25.8
    
    Data structure read access:
        read_list                       24.2    24.5    20.8    20.8    19.0   19.5
        read_deque                      24.7    25.5    20.2    20.6    19.8   20.2
        read_dict                       24.3    25.7    22.3    23.0    21.0   22.4
        read_strdict                    22.6    24.3    19.5    21.2    18.9   21.5
    
    Data structure write access:
        write_list                      27.1    28.5    22.5    21.6    20.0   20.0
        write_deque                     28.7    30.1    22.7    21.8    23.5   21.7
        write_dict                      31.4    33.3    29.3    29.2    24.7   25.4
        write_strdict                   28.4    29.9    27.5    25.2    23.1   24.5
    
    Stack (or queue) operations:
        list_append_pop                 93.4   112.7    75.4    74.2    50.8   50.6
        deque_append_pop                43.5    57.0    49.4    49.2    42.5   44.2
        deque_append_popleft            43.7    57.3    49.7    49.7    42.8   46.4
    
    Timing loop:
        loop_overhead                    0.5     0.6     0.4     0.3     0.3    0.3
    
    0,
    Python version                       3.4     3.5     3.6     3.7     3.8    3.9
    --------------                       ---     ---     ---     ---     ---    ---
    
    Variable and attribute read access:
        read_local                       7.1     7.1     5.4     5.1     3.9    3.9
        read_nonlocal                    7.1     8.1     5.8     5.4     4.4    4.5
        read_global                     15.5    19.0    14.3    13.6     7.6    7.8
        read_builtin                    21.1    21.6    18.5    19.0     7.5    7.8
        read_classvar_from_class        25.6    26.5    20.7    19.5    18.4   17.9
        read_classvar_from_instance     22.8    23.5    18.8    17.1    16.4   16.9
        read_instancevar                32.4    33.1    28.0    26.3    25.4   25.3
        read_instancevar_slots          27.8    31.3    20.8    20.8    20.2   20.5
        read_namedtuple                 73.8    57.5    45.0    46.8    18.4   18.7
        read_boundmethod                37.6    37.9    29.6    26.9    27.7   41.1
    
    Variable and attribute write access:
        write_local                      8.7     9.3     5.5     5.3     4.3    4.3
        write_nonlocal                  10.5    11.1     5.6     5.5     4.7    4.8
        write_global                    19.7    21.2    18.0    18.0    15.8   16.7
        write_classvar                  92.9    96.0   104.6   102.1    39.2   39.8
        write_instancevar               44.6    45.8    40.0    38.9    35.5   37.4
        write_instancevar_slots         35.6    36.1    27.3    26.6    25.7   25.8
    
    Data structure read access:
        read_list                       24.2    24.5    20.8    20.8    19.0   19.5
        read_deque                      24.7    25.5    20.2    20.6    19.8   20.2
        read_dict                       24.3    25.7    22.3    23.0    21.0   22.4
        read_strdict                    22.6    24.3    19.5    21.2    18.9   21.5
    
    Data structure write access:
        write_list                      27.1    28.5    22.5    21.6    20.0   20.0
        write_deque                     28.7    30.1    22.7    21.8    23.5   21.7
        write_dict                      31.4    33.3    29.3    29.2    24.7   25.4
        write_strdict                   28.4    29.9    27.5    25.2    23.1   24.5
    
    Stack (or queue) operations:
        list_append_pop                 93.4   112.7    75.4    74.2    50.8   50.6
        deque_append_pop                43.5    57.0    49.4    49.2    42.5   44.2
        deque_append_popleft            43.7    57.3    49.7    49.7    42.8   46.4
    
    Timing loop:
        loop_overhead                    0.5     0.6     0.4     0.3     0.3    0.3
    
    1,
    Python version                       3.4     3.5     3.6     3.7     3.8    3.9
    --------------                       ---     ---     ---     ---     ---    ---
    
    Variable and attribute read access:
        read_local                       7.1     7.1     5.4     5.1     3.9    3.9
        read_nonlocal                    7.1     8.1     5.8     5.4     4.4    4.5
        read_global                     15.5    19.0    14.3    13.6     7.6    7.8
        read_builtin                    21.1    21.6    18.5    19.0     7.5    7.8
        read_classvar_from_class        25.6    26.5    20.7    19.5    18.4   17.9
        read_classvar_from_instance     22.8    23.5    18.8    17.1    16.4   16.9
        read_instancevar                32.4    33.1    28.0    26.3    25.4   25.3
        read_instancevar_slots          27.8    31.3    20.8    20.8    20.2   20.5
        read_namedtuple                 73.8    57.5    45.0    46.8    18.4   18.7
        read_boundmethod                37.6    37.9    29.6    26.9    27.7   41.1
    
    Variable and attribute write access:
        write_local                      8.7     9.3     5.5     5.3     4.3    4.3
        write_nonlocal                  10.5    11.1     5.6     5.5     4.7    4.8
        write_global                    19.7    21.2    18.0    18.0    15.8   16.7
        write_classvar                  92.9    96.0   104.6   102.1    39.2   39.8
        write_instancevar               44.6    45.8    40.0    38.9    35.5   37.4
        write_instancevar_slots         35.6    36.1    27.3    26.6    25.7   25.8
    
    Data structure read access:
        read_list                       24.2    24.5    20.8    20.8    19.0   19.5
        read_deque                      24.7    25.5    20.2    20.6    19.8   20.2
        read_dict                       24.3    25.7    22.3    23.0    21.0   22.4
        read_strdict                    22.6    24.3    19.5    21.2    18.9   21.5
    
    Data structure write access:
        write_list                      27.1    28.5    22.5    21.6    20.0   20.0
        write_deque                     28.7    30.1    22.7    21.8    23.5   21.7
        write_dict                      31.4    33.3    29.3    29.2    24.7   25.4
        write_strdict                   28.4    29.9    27.5    25.2    23.1   24.5
    
    Stack (or queue) operations:
        list_append_pop                 93.4   112.7    75.4    74.2    50.8   50.6
        deque_append_pop                43.5    57.0    49.4    49.2    42.5   44.2
        deque_append_popleft            43.7    57.3    49.7    49.7    42.8   46.4
    
    Timing loop:
        loop_overhead                    0.5     0.6     0.4     0.3     0.3    0.3
    
    2,
    Python version                       3.4     3.5     3.6     3.7     3.8    3.9
    --------------                       ---     ---     ---     ---     ---    ---
    
    Variable and attribute read access:
        read_local                       7.1     7.1     5.4     5.1     3.9    3.9
        read_nonlocal                    7.1     8.1     5.8     5.4     4.4    4.5
        read_global                     15.5    19.0    14.3    13.6     7.6    7.8
        read_builtin                    21.1    21.6    18.5    19.0     7.5    7.8
        read_classvar_from_class        25.6    26.5    20.7    19.5    18.4   17.9
        read_classvar_from_instance     22.8    23.5    18.8    17.1    16.4   16.9
        read_instancevar                32.4    33.1    28.0    26.3    25.4   25.3
        read_instancevar_slots          27.8    31.3    20.8    20.8    20.2   20.5
        read_namedtuple                 73.8    57.5    45.0    46.8    18.4   18.7
        read_boundmethod                37.6    37.9    29.6    26.9    27.7   41.1
    
    Variable and attribute write access:
        write_local                      8.7     9.3     5.5     5.3     4.3    4.3
        write_nonlocal                  10.5    11.1     5.6     5.5     4.7    4.8
        write_global                    19.7    21.2    18.0    18.0    15.8   16.7
        write_classvar                  92.9    96.0   104.6   102.1    39.2   39.8
        write_instancevar               44.6    45.8    40.0    38.9    35.5   37.4
        write_instancevar_slots         35.6    36.1    27.3    26.6    25.7   25.8
    
    Data structure read access:
        read_list                       24.2    24.5    20.8    20.8    19.0   19.5
        read_deque                      24.7    25.5    20.2    20.6    19.8   20.2
        read_dict                       24.3    25.7    22.3    23.0    21.0   22.4
        read_strdict                    22.6    24.3    19.5    21.2    18.9   21.5
    
    Data structure write access:
        write_list                      27.1    28.5    22.5    21.6    20.0   20.0
        write_deque                     28.7    30.1    22.7    21.8    23.5   21.7
        write_dict                      31.4    33.3    29.3    29.2    24.7   25.4
        write_strdict                   28.4    29.9    27.5    25.2    23.1   24.5
    
    Stack (or queue) operations:
        list_append_pop                 93.4   112.7    75.4    74.2    50.8   50.6
        deque_append_pop                43.5    57.0    49.4    49.2    42.5   44.2
        deque_append_popleft            43.7    57.3    49.7    49.7    42.8   46.4
    
    Timing loop:
        loop_overhead                    0.5     0.6     0.4     0.3     0.3    0.3
    
    3,
    Python version                       3.4     3.5     3.6     3.7     3.8    3.9
    --------------                       ---     ---     ---     ---     ---    ---
    
    Variable and attribute read access:
        read_local                       7.1     7.1     5.4     5.1     3.9    3.9
        read_nonlocal                    7.1     8.1     5.8     5.4     4.4    4.5
        read_global                     15.5    19.0    14.3    13.6     7.6    7.8
        read_builtin                    21.1    21.6    18.5    19.0     7.5    7.8
        read_classvar_from_class        25.6    26.5    20.7    19.5    18.4   17.9
        read_classvar_from_instance     22.8    23.5    18.8    17.1    16.4   16.9
        read_instancevar                32.4    33.1    28.0    26.3    25.4   25.3
        read_instancevar_slots          27.8    31.3    20.8    20.8    20.2   20.5
        read_namedtuple                 73.8    57.5    45.0    46.8    18.4   18.7
        read_boundmethod                37.6    37.9    29.6    26.9    27.7   41.1
    
    Variable and attribute write access:
        write_local                      8.7     9.3     5.5     5.3     4.3    4.3
        write_nonlocal                  10.5    11.1     5.6     5.5     4.7    4.8
        write_global                    19.7    21.2    18.0    18.0    15.8   16.7
        write_classvar                  92.9    96.0   104.6   102.1    39.2   39.8
        write_instancevar               44.6    45.8    40.0    38.9    35.5   37.4
        write_instancevar_slots         35.6    36.1    27.3    26.6    25.7   25.8
    
    Data structure read access:
        read_list                       24.2    24.5    20.8    20.8    19.0   19.5
        read_deque                      24.7    25.5    20.2    20.6    19.8   20.2
        read_dict                       24.3    25.7    22.3    23.0    21.0   22.4
        read_strdict                    22.6    24.3    19.5    21.2    18.9   21.5
    
    Data structure write access:
        write_list                      27.1    28.5    22.5    21.6    20.0   20.0
        write_deque                     28.7    30.1    22.7    21.8    23.5   21.7
        write_dict                      31.4    33.3    29.3    29.2    24.7   25.4
        write_strdict                   28.4    29.9    27.5    25.2    23.1   24.5
    
    Stack (or queue) operations:
        list_append_pop                 93.4   112.7    75.4    74.2    50.8   50.6
        deque_append_pop                43.5    57.0    49.4    49.2    42.5   44.2
        deque_append_popleft            43.7    57.3    49.7    49.7    42.8   46.4
    
    Timing loop:
        loop_overhead                    0.5     0.6     0.4     0.3     0.3    0.3
    
    4) hiện đang sử dụng ABI ổn định được xác định bởi PEP 384.

Các mô -đun thư viện mới:

  • PEP 615, cơ sở dữ liệu múi giờ IANA hiện có mặt trong thư viện tiêu chuẩn trong mô -đun

    Python version                       3.4     3.5     3.6     3.7     3.8    3.9
    --------------                       ---     ---     ---     ---     ---    ---
    
    Variable and attribute read access:
        read_local                       7.1     7.1     5.4     5.1     3.9    3.9
        read_nonlocal                    7.1     8.1     5.8     5.4     4.4    4.5
        read_global                     15.5    19.0    14.3    13.6     7.6    7.8
        read_builtin                    21.1    21.6    18.5    19.0     7.5    7.8
        read_classvar_from_class        25.6    26.5    20.7    19.5    18.4   17.9
        read_classvar_from_instance     22.8    23.5    18.8    17.1    16.4   16.9
        read_instancevar                32.4    33.1    28.0    26.3    25.4   25.3
        read_instancevar_slots          27.8    31.3    20.8    20.8    20.2   20.5
        read_namedtuple                 73.8    57.5    45.0    46.8    18.4   18.7
        read_boundmethod                37.6    37.9    29.6    26.9    27.7   41.1
    
    Variable and attribute write access:
        write_local                      8.7     9.3     5.5     5.3     4.3    4.3
        write_nonlocal                  10.5    11.1     5.6     5.5     4.7    4.8
        write_global                    19.7    21.2    18.0    18.0    15.8   16.7
        write_classvar                  92.9    96.0   104.6   102.1    39.2   39.8
        write_instancevar               44.6    45.8    40.0    38.9    35.5   37.4
        write_instancevar_slots         35.6    36.1    27.3    26.6    25.7   25.8
    
    Data structure read access:
        read_list                       24.2    24.5    20.8    20.8    19.0   19.5
        read_deque                      24.7    25.5    20.2    20.6    19.8   20.2
        read_dict                       24.3    25.7    22.3    23.0    21.0   22.4
        read_strdict                    22.6    24.3    19.5    21.2    18.9   21.5
    
    Data structure write access:
        write_list                      27.1    28.5    22.5    21.6    20.0   20.0
        write_deque                     28.7    30.1    22.7    21.8    23.5   21.7
        write_dict                      31.4    33.3    29.3    29.2    24.7   25.4
        write_strdict                   28.4    29.9    27.5    25.2    23.1   24.5
    
    Stack (or queue) operations:
        list_append_pop                 93.4   112.7    75.4    74.2    50.8   50.6
        deque_append_pop                43.5    57.0    49.4    49.2    42.5   44.2
        deque_append_popleft            43.7    57.3    49.7    49.7    42.8   46.4
    
    Timing loop:
        loop_overhead                    0.5     0.6     0.4     0.3     0.3    0.3
    
    5;, the IANA Time Zone Database is now present in the standard library in the
    Python version                       3.4     3.5     3.6     3.7     3.8    3.9
    --------------                       ---     ---     ---     ---     ---    ---
    
    Variable and attribute read access:
        read_local                       7.1     7.1     5.4     5.1     3.9    3.9
        read_nonlocal                    7.1     8.1     5.8     5.4     4.4    4.5
        read_global                     15.5    19.0    14.3    13.6     7.6    7.8
        read_builtin                    21.1    21.6    18.5    19.0     7.5    7.8
        read_classvar_from_class        25.6    26.5    20.7    19.5    18.4   17.9
        read_classvar_from_instance     22.8    23.5    18.8    17.1    16.4   16.9
        read_instancevar                32.4    33.1    28.0    26.3    25.4   25.3
        read_instancevar_slots          27.8    31.3    20.8    20.8    20.2   20.5
        read_namedtuple                 73.8    57.5    45.0    46.8    18.4   18.7
        read_boundmethod                37.6    37.9    29.6    26.9    27.7   41.1
    
    Variable and attribute write access:
        write_local                      8.7     9.3     5.5     5.3     4.3    4.3
        write_nonlocal                  10.5    11.1     5.6     5.5     4.7    4.8
        write_global                    19.7    21.2    18.0    18.0    15.8   16.7
        write_classvar                  92.9    96.0   104.6   102.1    39.2   39.8
        write_instancevar               44.6    45.8    40.0    38.9    35.5   37.4
        write_instancevar_slots         35.6    36.1    27.3    26.6    25.7   25.8
    
    Data structure read access:
        read_list                       24.2    24.5    20.8    20.8    19.0   19.5
        read_deque                      24.7    25.5    20.2    20.6    19.8   20.2
        read_dict                       24.3    25.7    22.3    23.0    21.0   22.4
        read_strdict                    22.6    24.3    19.5    21.2    18.9   21.5
    
    Data structure write access:
        write_list                      27.1    28.5    22.5    21.6    20.0   20.0
        write_deque                     28.7    30.1    22.7    21.8    23.5   21.7
        write_dict                      31.4    33.3    29.3    29.2    24.7   25.4
        write_strdict                   28.4    29.9    27.5    25.2    23.1   24.5
    
    Stack (or queue) operations:
        list_append_pop                 93.4   112.7    75.4    74.2    50.8   50.6
        deque_append_pop                43.5    57.0    49.4    49.2    42.5   44.2
        deque_append_popleft            43.7    57.3    49.7    49.7    42.8   46.4
    
    Timing loop:
        loop_overhead                    0.5     0.6     0.4     0.3     0.3    0.3
    
    5 module;

  • Việc triển khai một loại tô pô của một biểu đồ hiện được cung cấp trong mô -đun

    Python version                       3.4     3.5     3.6     3.7     3.8    3.9
    --------------                       ---     ---     ---     ---     ---    ---
    
    Variable and attribute read access:
        read_local                       7.1     7.1     5.4     5.1     3.9    3.9
        read_nonlocal                    7.1     8.1     5.8     5.4     4.4    4.5
        read_global                     15.5    19.0    14.3    13.6     7.6    7.8
        read_builtin                    21.1    21.6    18.5    19.0     7.5    7.8
        read_classvar_from_class        25.6    26.5    20.7    19.5    18.4   17.9
        read_classvar_from_instance     22.8    23.5    18.8    17.1    16.4   16.9
        read_instancevar                32.4    33.1    28.0    26.3    25.4   25.3
        read_instancevar_slots          27.8    31.3    20.8    20.8    20.2   20.5
        read_namedtuple                 73.8    57.5    45.0    46.8    18.4   18.7
        read_boundmethod                37.6    37.9    29.6    26.9    27.7   41.1
    
    Variable and attribute write access:
        write_local                      8.7     9.3     5.5     5.3     4.3    4.3
        write_nonlocal                  10.5    11.1     5.6     5.5     4.7    4.8
        write_global                    19.7    21.2    18.0    18.0    15.8   16.7
        write_classvar                  92.9    96.0   104.6   102.1    39.2   39.8
        write_instancevar               44.6    45.8    40.0    38.9    35.5   37.4
        write_instancevar_slots         35.6    36.1    27.3    26.6    25.7   25.8
    
    Data structure read access:
        read_list                       24.2    24.5    20.8    20.8    19.0   19.5
        read_deque                      24.7    25.5    20.2    20.6    19.8   20.2
        read_dict                       24.3    25.7    22.3    23.0    21.0   22.4
        read_strdict                    22.6    24.3    19.5    21.2    18.9   21.5
    
    Data structure write access:
        write_list                      27.1    28.5    22.5    21.6    20.0   20.0
        write_deque                     28.7    30.1    22.7    21.8    23.5   21.7
        write_dict                      31.4    33.3    29.3    29.2    24.7   25.4
        write_strdict                   28.4    29.9    27.5    25.2    23.1   24.5
    
    Stack (or queue) operations:
        list_append_pop                 93.4   112.7    75.4    74.2    50.8   50.6
        deque_append_pop                43.5    57.0    49.4    49.2    42.5   44.2
        deque_append_popleft            43.7    57.3    49.7    49.7    42.8   46.4
    
    Timing loop:
        loop_overhead                    0.5     0.6     0.4     0.3     0.3    0.3
    
    6 mới.

Quy trình phát hành thay đổi:

  • PEP 602, CPython áp dụng chu kỳ phát hành hàng năm., CPython adopts an annual release cycle.

Bạn nên kiểm tra không dùng nữa trong mã của bạn

Khi Python 2.7 vẫn được hỗ trợ, rất nhiều chức năng trong Python 3 được giữ để tương thích ngược với Python 2.7. Với sự kết thúc của hỗ trợ Python 2, các lớp tương thích ngược này đã bị loại bỏ hoặc sẽ sớm bị xóa. Hầu hết trong số họ đã phát ra một cảnh báo

Python version                       3.4     3.5     3.6     3.7     3.8    3.9
--------------                       ---     ---     ---     ---     ---    ---

Variable and attribute read access:
    read_local                       7.1     7.1     5.4     5.1     3.9    3.9
    read_nonlocal                    7.1     8.1     5.8     5.4     4.4    4.5
    read_global                     15.5    19.0    14.3    13.6     7.6    7.8
    read_builtin                    21.1    21.6    18.5    19.0     7.5    7.8
    read_classvar_from_class        25.6    26.5    20.7    19.5    18.4   17.9
    read_classvar_from_instance     22.8    23.5    18.8    17.1    16.4   16.9
    read_instancevar                32.4    33.1    28.0    26.3    25.4   25.3
    read_instancevar_slots          27.8    31.3    20.8    20.8    20.2   20.5
    read_namedtuple                 73.8    57.5    45.0    46.8    18.4   18.7
    read_boundmethod                37.6    37.9    29.6    26.9    27.7   41.1

Variable and attribute write access:
    write_local                      8.7     9.3     5.5     5.3     4.3    4.3
    write_nonlocal                  10.5    11.1     5.6     5.5     4.7    4.8
    write_global                    19.7    21.2    18.0    18.0    15.8   16.7
    write_classvar                  92.9    96.0   104.6   102.1    39.2   39.8
    write_instancevar               44.6    45.8    40.0    38.9    35.5   37.4
    write_instancevar_slots         35.6    36.1    27.3    26.6    25.7   25.8

Data structure read access:
    read_list                       24.2    24.5    20.8    20.8    19.0   19.5
    read_deque                      24.7    25.5    20.2    20.6    19.8   20.2
    read_dict                       24.3    25.7    22.3    23.0    21.0   22.4
    read_strdict                    22.6    24.3    19.5    21.2    18.9   21.5

Data structure write access:
    write_list                      27.1    28.5    22.5    21.6    20.0   20.0
    write_deque                     28.7    30.1    22.7    21.8    23.5   21.7
    write_dict                      31.4    33.3    29.3    29.2    24.7   25.4
    write_strdict                   28.4    29.9    27.5    25.2    23.1   24.5

Stack (or queue) operations:
    list_append_pop                 93.4   112.7    75.4    74.2    50.8   50.6
    deque_append_pop                43.5    57.0    49.4    49.2    42.5   44.2
    deque_append_popleft            43.7    57.3    49.7    49.7    42.8   46.4

Timing loop:
    loop_overhead                    0.5     0.6     0.4     0.3     0.3    0.3
7 trong vài năm. Ví dụ: sử dụng
Python version                       3.4     3.5     3.6     3.7     3.8    3.9
--------------                       ---     ---     ---     ---     ---    ---

Variable and attribute read access:
    read_local                       7.1     7.1     5.4     5.1     3.9    3.9
    read_nonlocal                    7.1     8.1     5.8     5.4     4.4    4.5
    read_global                     15.5    19.0    14.3    13.6     7.6    7.8
    read_builtin                    21.1    21.6    18.5    19.0     7.5    7.8
    read_classvar_from_class        25.6    26.5    20.7    19.5    18.4   17.9
    read_classvar_from_instance     22.8    23.5    18.8    17.1    16.4   16.9
    read_instancevar                32.4    33.1    28.0    26.3    25.4   25.3
    read_instancevar_slots          27.8    31.3    20.8    20.8    20.2   20.5
    read_namedtuple                 73.8    57.5    45.0    46.8    18.4   18.7
    read_boundmethod                37.6    37.9    29.6    26.9    27.7   41.1

Variable and attribute write access:
    write_local                      8.7     9.3     5.5     5.3     4.3    4.3
    write_nonlocal                  10.5    11.1     5.6     5.5     4.7    4.8
    write_global                    19.7    21.2    18.0    18.0    15.8   16.7
    write_classvar                  92.9    96.0   104.6   102.1    39.2   39.8
    write_instancevar               44.6    45.8    40.0    38.9    35.5   37.4
    write_instancevar_slots         35.6    36.1    27.3    26.6    25.7   25.8

Data structure read access:
    read_list                       24.2    24.5    20.8    20.8    19.0   19.5
    read_deque                      24.7    25.5    20.2    20.6    19.8   20.2
    read_dict                       24.3    25.7    22.3    23.0    21.0   22.4
    read_strdict                    22.6    24.3    19.5    21.2    18.9   21.5

Data structure write access:
    write_list                      27.1    28.5    22.5    21.6    20.0   20.0
    write_deque                     28.7    30.1    22.7    21.8    23.5   21.7
    write_dict                      31.4    33.3    29.3    29.2    24.7   25.4
    write_strdict                   28.4    29.9    27.5    25.2    23.1   24.5

Stack (or queue) operations:
    list_append_pop                 93.4   112.7    75.4    74.2    50.8   50.6
    deque_append_pop                43.5    57.0    49.4    49.2    42.5   44.2
    deque_append_popleft            43.7    57.3    49.7    49.7    42.8   46.4

Timing loop:
    loop_overhead                    0.5     0.6     0.4     0.3     0.3    0.3
8 thay vì
Python version                       3.4     3.5     3.6     3.7     3.8    3.9
--------------                       ---     ---     ---     ---     ---    ---

Variable and attribute read access:
    read_local                       7.1     7.1     5.4     5.1     3.9    3.9
    read_nonlocal                    7.1     8.1     5.8     5.4     4.4    4.5
    read_global                     15.5    19.0    14.3    13.6     7.6    7.8
    read_builtin                    21.1    21.6    18.5    19.0     7.5    7.8
    read_classvar_from_class        25.6    26.5    20.7    19.5    18.4   17.9
    read_classvar_from_instance     22.8    23.5    18.8    17.1    16.4   16.9
    read_instancevar                32.4    33.1    28.0    26.3    25.4   25.3
    read_instancevar_slots          27.8    31.3    20.8    20.8    20.2   20.5
    read_namedtuple                 73.8    57.5    45.0    46.8    18.4   18.7
    read_boundmethod                37.6    37.9    29.6    26.9    27.7   41.1

Variable and attribute write access:
    write_local                      8.7     9.3     5.5     5.3     4.3    4.3
    write_nonlocal                  10.5    11.1     5.6     5.5     4.7    4.8
    write_global                    19.7    21.2    18.0    18.0    15.8   16.7
    write_classvar                  92.9    96.0   104.6   102.1    39.2   39.8
    write_instancevar               44.6    45.8    40.0    38.9    35.5   37.4
    write_instancevar_slots         35.6    36.1    27.3    26.6    25.7   25.8

Data structure read access:
    read_list                       24.2    24.5    20.8    20.8    19.0   19.5
    read_deque                      24.7    25.5    20.2    20.6    19.8   20.2
    read_dict                       24.3    25.7    22.3    23.0    21.0   22.4
    read_strdict                    22.6    24.3    19.5    21.2    18.9   21.5

Data structure write access:
    write_list                      27.1    28.5    22.5    21.6    20.0   20.0
    write_deque                     28.7    30.1    22.7    21.8    23.5   21.7
    write_dict                      31.4    33.3    29.3    29.2    24.7   25.4
    write_strdict                   28.4    29.9    27.5    25.2    23.1   24.5

Stack (or queue) operations:
    list_append_pop                 93.4   112.7    75.4    74.2    50.8   50.6
    deque_append_pop                43.5    57.0    49.4    49.2    42.5   44.2
    deque_append_popleft            43.7    57.3    49.7    49.7    42.8   46.4

Timing loop:
    loop_overhead                    0.5     0.6     0.4     0.3     0.3    0.3
9 phát ra
Python version                       3.4     3.5     3.6     3.7     3.8    3.9
--------------                       ---     ---     ---     ---     ---    ---

Variable and attribute read access:
    read_local                       7.1     7.1     5.4     5.1     3.9    3.9
    read_nonlocal                    7.1     8.1     5.8     5.4     4.4    4.5
    read_global                     15.5    19.0    14.3    13.6     7.6    7.8
    read_builtin                    21.1    21.6    18.5    19.0     7.5    7.8
    read_classvar_from_class        25.6    26.5    20.7    19.5    18.4   17.9
    read_classvar_from_instance     22.8    23.5    18.8    17.1    16.4   16.9
    read_instancevar                32.4    33.1    28.0    26.3    25.4   25.3
    read_instancevar_slots          27.8    31.3    20.8    20.8    20.2   20.5
    read_namedtuple                 73.8    57.5    45.0    46.8    18.4   18.7
    read_boundmethod                37.6    37.9    29.6    26.9    27.7   41.1

Variable and attribute write access:
    write_local                      8.7     9.3     5.5     5.3     4.3    4.3
    write_nonlocal                  10.5    11.1     5.6     5.5     4.7    4.8
    write_global                    19.7    21.2    18.0    18.0    15.8   16.7
    write_classvar                  92.9    96.0   104.6   102.1    39.2   39.8
    write_instancevar               44.6    45.8    40.0    38.9    35.5   37.4
    write_instancevar_slots         35.6    36.1    27.3    26.6    25.7   25.8

Data structure read access:
    read_list                       24.2    24.5    20.8    20.8    19.0   19.5
    read_deque                      24.7    25.5    20.2    20.6    19.8   20.2
    read_dict                       24.3    25.7    22.3    23.0    21.0   22.4
    read_strdict                    22.6    24.3    19.5    21.2    18.9   21.5

Data structure write access:
    write_list                      27.1    28.5    22.5    21.6    20.0   20.0
    write_deque                     28.7    30.1    22.7    21.8    23.5   21.7
    write_dict                      31.4    33.3    29.3    29.2    24.7   25.4
    write_strdict                   28.4    29.9    27.5    25.2    23.1   24.5

Stack (or queue) operations:
    list_append_pop                 93.4   112.7    75.4    74.2    50.8   50.6
    deque_append_pop                43.5    57.0    49.4    49.2    42.5   44.2
    deque_append_popleft            43.7    57.3    49.7    49.7    42.8   46.4

Timing loop:
    loop_overhead                    0.5     0.6     0.4     0.3     0.3    0.3
7 kể từ Python 3.3, được phát hành vào năm 2012.

Kiểm tra ứng dụng của bạn với tùy chọn dòng lệnh

int
foo_traverse(foo_struct *self, visitproc visit, void *arg) {
// Rest of the traverse function
#if PY_VERSION_HEX >= 0x03090000
    // This was not needed before Python 3.9 (Python issue 35810 and 40217)
    Py_VISIT(Py_TYPE(self));
#endif
}
1
int
foo_traverse(foo_struct *self, visitproc visit, void *arg) {
// Rest of the traverse function
#if PY_VERSION_HEX >= 0x03090000
    // This was not needed before Python 3.9 (Python issue 35810 and 40217)
    Py_VISIT(Py_TYPE(self));
#endif
}
2 để xem
Python version                       3.4     3.5     3.6     3.7     3.8    3.9
--------------                       ---     ---     ---     ---     ---    ---

Variable and attribute read access:
    read_local                       7.1     7.1     5.4     5.1     3.9    3.9
    read_nonlocal                    7.1     8.1     5.8     5.4     4.4    4.5
    read_global                     15.5    19.0    14.3    13.6     7.6    7.8
    read_builtin                    21.1    21.6    18.5    19.0     7.5    7.8
    read_classvar_from_class        25.6    26.5    20.7    19.5    18.4   17.9
    read_classvar_from_instance     22.8    23.5    18.8    17.1    16.4   16.9
    read_instancevar                32.4    33.1    28.0    26.3    25.4   25.3
    read_instancevar_slots          27.8    31.3    20.8    20.8    20.2   20.5
    read_namedtuple                 73.8    57.5    45.0    46.8    18.4   18.7
    read_boundmethod                37.6    37.9    29.6    26.9    27.7   41.1

Variable and attribute write access:
    write_local                      8.7     9.3     5.5     5.3     4.3    4.3
    write_nonlocal                  10.5    11.1     5.6     5.5     4.7    4.8
    write_global                    19.7    21.2    18.0    18.0    15.8   16.7
    write_classvar                  92.9    96.0   104.6   102.1    39.2   39.8
    write_instancevar               44.6    45.8    40.0    38.9    35.5   37.4
    write_instancevar_slots         35.6    36.1    27.3    26.6    25.7   25.8

Data structure read access:
    read_list                       24.2    24.5    20.8    20.8    19.0   19.5
    read_deque                      24.7    25.5    20.2    20.6    19.8   20.2
    read_dict                       24.3    25.7    22.3    23.0    21.0   22.4
    read_strdict                    22.6    24.3    19.5    21.2    18.9   21.5

Data structure write access:
    write_list                      27.1    28.5    22.5    21.6    20.0   20.0
    write_deque                     28.7    30.1    22.7    21.8    23.5   21.7
    write_dict                      31.4    33.3    29.3    29.2    24.7   25.4
    write_strdict                   28.4    29.9    27.5    25.2    23.1   24.5

Stack (or queue) operations:
    list_append_pop                 93.4   112.7    75.4    74.2    50.8   50.6
    deque_append_pop                43.5    57.0    49.4    49.2    42.5   44.2
    deque_append_popleft            43.7    57.3    49.7    49.7    42.8   46.4

Timing loop:
    loop_overhead                    0.5     0.6     0.4     0.3     0.3    0.3
7 và
int
foo_traverse(foo_struct *self, visitproc visit, void *arg) {
// Rest of the traverse function
#if PY_VERSION_HEX >= 0x03090000
    // This was not needed before Python 3.9 (Python issue 35810 and 40217)
    Py_VISIT(Py_TYPE(self));
#endif
}
4 hoặc thậm chí với
int
foo_traverse(foo_struct *self, visitproc visit, void *arg) {
// Rest of the traverse function
#if PY_VERSION_HEX >= 0x03090000
    // This was not needed before Python 3.9 (Python issue 35810 and 40217)
    Py_VISIT(Py_TYPE(self));
#endif
}
1
int
foo_traverse(foo_struct *self, visitproc visit, void *arg) {
// Rest of the traverse function
#if PY_VERSION_HEX >= 0x03090000
    // This was not needed before Python 3.9 (Python issue 35810 and 40217)
    Py_VISIT(Py_TYPE(self));
#endif
}
6 để coi chúng là lỗi. Bộ lọc cảnh báo có thể được sử dụng để bỏ qua các cảnh báo từ mã của bên thứ ba.Warnings Filter can be used to ignore warnings from third-party code.

Python 3.9 là phiên bản cuối cùng cung cấp các lớp tương thích ngược Python 2 đó, để dành nhiều thời gian hơn cho các dự án Python để tổ chức việc loại bỏ hỗ trợ Python 2 và thêm hỗ trợ cho Python 3.9.

Bí danh cho các lớp cơ sở trừu tượng trong mô -đun

int
foo_traverse(foo_struct *self, visitproc visit, void *arg) {
// Rest of the traverse function
#if PY_VERSION_HEX >= 0x03090000
    // This was not needed before Python 3.9 (Python issue 35810 and 40217)
    Py_VISIT(Py_TYPE(self));
#endif
}
7, như bí danh
Python version                       3.4     3.5     3.6     3.7     3.8    3.9
--------------                       ---     ---     ---     ---     ---    ---

Variable and attribute read access:
    read_local                       7.1     7.1     5.4     5.1     3.9    3.9
    read_nonlocal                    7.1     8.1     5.8     5.4     4.4    4.5
    read_global                     15.5    19.0    14.3    13.6     7.6    7.8
    read_builtin                    21.1    21.6    18.5    19.0     7.5    7.8
    read_classvar_from_class        25.6    26.5    20.7    19.5    18.4   17.9
    read_classvar_from_instance     22.8    23.5    18.8    17.1    16.4   16.9
    read_instancevar                32.4    33.1    28.0    26.3    25.4   25.3
    read_instancevar_slots          27.8    31.3    20.8    20.8    20.2   20.5
    read_namedtuple                 73.8    57.5    45.0    46.8    18.4   18.7
    read_boundmethod                37.6    37.9    29.6    26.9    27.7   41.1

Variable and attribute write access:
    write_local                      8.7     9.3     5.5     5.3     4.3    4.3
    write_nonlocal                  10.5    11.1     5.6     5.5     4.7    4.8
    write_global                    19.7    21.2    18.0    18.0    15.8   16.7
    write_classvar                  92.9    96.0   104.6   102.1    39.2   39.8
    write_instancevar               44.6    45.8    40.0    38.9    35.5   37.4
    write_instancevar_slots         35.6    36.1    27.3    26.6    25.7   25.8

Data structure read access:
    read_list                       24.2    24.5    20.8    20.8    19.0   19.5
    read_deque                      24.7    25.5    20.2    20.6    19.8   20.2
    read_dict                       24.3    25.7    22.3    23.0    21.0   22.4
    read_strdict                    22.6    24.3    19.5    21.2    18.9   21.5

Data structure write access:
    write_list                      27.1    28.5    22.5    21.6    20.0   20.0
    write_deque                     28.7    30.1    22.7    21.8    23.5   21.7
    write_dict                      31.4    33.3    29.3    29.2    24.7   25.4
    write_strdict                   28.4    29.9    27.5    25.2    23.1   24.5

Stack (or queue) operations:
    list_append_pop                 93.4   112.7    75.4    74.2    50.8   50.6
    deque_append_pop                43.5    57.0    49.4    49.2    42.5   44.2
    deque_append_popleft            43.7    57.3    49.7    49.7    42.8   46.4

Timing loop:
    loop_overhead                    0.5     0.6     0.4     0.3     0.3    0.3
8 cho
Python version                       3.4     3.5     3.6     3.7     3.8    3.9
--------------                       ---     ---     ---     ---     ---    ---

Variable and attribute read access:
    read_local                       7.1     7.1     5.4     5.1     3.9    3.9
    read_nonlocal                    7.1     8.1     5.8     5.4     4.4    4.5
    read_global                     15.5    19.0    14.3    13.6     7.6    7.8
    read_builtin                    21.1    21.6    18.5    19.0     7.5    7.8
    read_classvar_from_class        25.6    26.5    20.7    19.5    18.4   17.9
    read_classvar_from_instance     22.8    23.5    18.8    17.1    16.4   16.9
    read_instancevar                32.4    33.1    28.0    26.3    25.4   25.3
    read_instancevar_slots          27.8    31.3    20.8    20.8    20.2   20.5
    read_namedtuple                 73.8    57.5    45.0    46.8    18.4   18.7
    read_boundmethod                37.6    37.9    29.6    26.9    27.7   41.1

Variable and attribute write access:
    write_local                      8.7     9.3     5.5     5.3     4.3    4.3
    write_nonlocal                  10.5    11.1     5.6     5.5     4.7    4.8
    write_global                    19.7    21.2    18.0    18.0    15.8   16.7
    write_classvar                  92.9    96.0   104.6   102.1    39.2   39.8
    write_instancevar               44.6    45.8    40.0    38.9    35.5   37.4
    write_instancevar_slots         35.6    36.1    27.3    26.6    25.7   25.8

Data structure read access:
    read_list                       24.2    24.5    20.8    20.8    19.0   19.5
    read_deque                      24.7    25.5    20.2    20.6    19.8   20.2
    read_dict                       24.3    25.7    22.3    23.0    21.0   22.4
    read_strdict                    22.6    24.3    19.5    21.2    18.9   21.5

Data structure write access:
    write_list                      27.1    28.5    22.5    21.6    20.0   20.0
    write_deque                     28.7    30.1    22.7    21.8    23.5   21.7
    write_dict                      31.4    33.3    29.3    29.2    24.7   25.4
    write_strdict                   28.4    29.9    27.5    25.2    23.1   24.5

Stack (or queue) operations:
    list_append_pop                 93.4   112.7    75.4    74.2    50.8   50.6
    deque_append_pop                43.5    57.0    49.4    49.2    42.5   44.2
    deque_append_popleft            43.7    57.3    49.7    49.7    42.8   46.4

Timing loop:
    loop_overhead                    0.5     0.6     0.4     0.3     0.3    0.3
9, được giữ cho một bản phát hành cuối cùng để tương thích ngược. Chúng sẽ được gỡ bỏ khỏi Python 3.10.Abstract Base Classes in the
int
foo_traverse(foo_struct *self, visitproc visit, void *arg) {
// Rest of the traverse function
#if PY_VERSION_HEX >= 0x03090000
    // This was not needed before Python 3.9 (Python issue 35810 and 40217)
    Py_VISIT(Py_TYPE(self));
#endif
}
7 module, like
Python version                       3.4     3.5     3.6     3.7     3.8    3.9
--------------                       ---     ---     ---     ---     ---    ---

Variable and attribute read access:
    read_local                       7.1     7.1     5.4     5.1     3.9    3.9
    read_nonlocal                    7.1     8.1     5.8     5.4     4.4    4.5
    read_global                     15.5    19.0    14.3    13.6     7.6    7.8
    read_builtin                    21.1    21.6    18.5    19.0     7.5    7.8
    read_classvar_from_class        25.6    26.5    20.7    19.5    18.4   17.9
    read_classvar_from_instance     22.8    23.5    18.8    17.1    16.4   16.9
    read_instancevar                32.4    33.1    28.0    26.3    25.4   25.3
    read_instancevar_slots          27.8    31.3    20.8    20.8    20.2   20.5
    read_namedtuple                 73.8    57.5    45.0    46.8    18.4   18.7
    read_boundmethod                37.6    37.9    29.6    26.9    27.7   41.1

Variable and attribute write access:
    write_local                      8.7     9.3     5.5     5.3     4.3    4.3
    write_nonlocal                  10.5    11.1     5.6     5.5     4.7    4.8
    write_global                    19.7    21.2    18.0    18.0    15.8   16.7
    write_classvar                  92.9    96.0   104.6   102.1    39.2   39.8
    write_instancevar               44.6    45.8    40.0    38.9    35.5   37.4
    write_instancevar_slots         35.6    36.1    27.3    26.6    25.7   25.8

Data structure read access:
    read_list                       24.2    24.5    20.8    20.8    19.0   19.5
    read_deque                      24.7    25.5    20.2    20.6    19.8   20.2
    read_dict                       24.3    25.7    22.3    23.0    21.0   22.4
    read_strdict                    22.6    24.3    19.5    21.2    18.9   21.5

Data structure write access:
    write_list                      27.1    28.5    22.5    21.6    20.0   20.0
    write_deque                     28.7    30.1    22.7    21.8    23.5   21.7
    write_dict                      31.4    33.3    29.3    29.2    24.7   25.4
    write_strdict                   28.4    29.9    27.5    25.2    23.1   24.5

Stack (or queue) operations:
    list_append_pop                 93.4   112.7    75.4    74.2    50.8   50.6
    deque_append_pop                43.5    57.0    49.4    49.2    42.5   44.2
    deque_append_popleft            43.7    57.3    49.7    49.7    42.8   46.4

Timing loop:
    loop_overhead                    0.5     0.6     0.4     0.3     0.3    0.3
8 alias to
Python version                       3.4     3.5     3.6     3.7     3.8    3.9
--------------                       ---     ---     ---     ---     ---    ---

Variable and attribute read access:
    read_local                       7.1     7.1     5.4     5.1     3.9    3.9
    read_nonlocal                    7.1     8.1     5.8     5.4     4.4    4.5
    read_global                     15.5    19.0    14.3    13.6     7.6    7.8
    read_builtin                    21.1    21.6    18.5    19.0     7.5    7.8
    read_classvar_from_class        25.6    26.5    20.7    19.5    18.4   17.9
    read_classvar_from_instance     22.8    23.5    18.8    17.1    16.4   16.9
    read_instancevar                32.4    33.1    28.0    26.3    25.4   25.3
    read_instancevar_slots          27.8    31.3    20.8    20.8    20.2   20.5
    read_namedtuple                 73.8    57.5    45.0    46.8    18.4   18.7
    read_boundmethod                37.6    37.9    29.6    26.9    27.7   41.1

Variable and attribute write access:
    write_local                      8.7     9.3     5.5     5.3     4.3    4.3
    write_nonlocal                  10.5    11.1     5.6     5.5     4.7    4.8
    write_global                    19.7    21.2    18.0    18.0    15.8   16.7
    write_classvar                  92.9    96.0   104.6   102.1    39.2   39.8
    write_instancevar               44.6    45.8    40.0    38.9    35.5   37.4
    write_instancevar_slots         35.6    36.1    27.3    26.6    25.7   25.8

Data structure read access:
    read_list                       24.2    24.5    20.8    20.8    19.0   19.5
    read_deque                      24.7    25.5    20.2    20.6    19.8   20.2
    read_dict                       24.3    25.7    22.3    23.0    21.0   22.4
    read_strdict                    22.6    24.3    19.5    21.2    18.9   21.5

Data structure write access:
    write_list                      27.1    28.5    22.5    21.6    20.0   20.0
    write_deque                     28.7    30.1    22.7    21.8    23.5   21.7
    write_dict                      31.4    33.3    29.3    29.2    24.7   25.4
    write_strdict                   28.4    29.9    27.5    25.2    23.1   24.5

Stack (or queue) operations:
    list_append_pop                 93.4   112.7    75.4    74.2    50.8   50.6
    deque_append_pop                43.5    57.0    49.4    49.2    42.5   44.2
    deque_append_popleft            43.7    57.3    49.7    49.7    42.8   46.4

Timing loop:
    loop_overhead                    0.5     0.6     0.4     0.3     0.3    0.3
9, are kept for one last release for backward compatibility. They will be removed from Python 3.10.

Tổng quát hơn, hãy cố gắng chạy các bài kiểm tra của bạn trong chế độ phát triển Python giúp chuẩn bị mã của bạn để làm cho nó tương thích với phiên bản Python tiếp theo.Python Development Mode which helps to prepare your code to make it compatible with the next Python version.

LƯU Ý: Một số phiếu giảm giá có sẵn đã được xóa trong phiên bản Python này. Tham khảo phần bị loại bỏ.Removed section.

Các tính năng mới¶

Các nhà khai thác và cập nhật từ điển Merge & Cập nhật

Các nhà khai thác hợp nhất (

base->tp_traverse(self, visit, arg)
0) và cập nhật (
base->tp_traverse(self, visit, arg)
1) đã được thêm vào lớp dict tích hợp. Những người bổ sung cho các phương pháp
base->tp_traverse(self, visit, arg)
3 và
base->tp_traverse(self, visit, arg)
4 hiện có để hợp nhất các từ điển.

Example:

>>> x = {"key1": "value1 from x", "key2": "value2 from x"}
>>> y = {"key2": "value2 from y", "key3": "value3 from y"}
>>> x | y
{'key1': 'value1 from x', 'key2': 'value2 from y', 'key3': 'value3 from y'}
>>> y | x
{'key2': 'value2 from x', 'key3': 'value3 from y', 'key1': 'value1 from x'}

Xem PEP 584 để biết mô tả đầy đủ. (Được đóng góp bởi Brandt Bucher trong BPO-36144.)PEP 584 for a full description. (Contributed by Brandt Bucher in bpo-36144.)

Các phương thức chuỗi mới để xóa tiền tố và hậu tố

base->tp_traverse(self, visit, arg)
5 và
base->tp_traverse(self, visit, arg)
6 đã được thêm vào để dễ dàng loại bỏ một tiền tố không cần thiết hoặc hậu tố từ một chuỗi. Các phương pháp tương ứng
base->tp_traverse(self, visit, arg)
7,
base->tp_traverse(self, visit, arg)
8 và
base->tp_traverse(self, visit, arg)
9 cũng đã được thêm vào. Xem PEP 616 để biết mô tả đầy đủ. (Được đóng góp bởi Dennis Sweeney trong BPO-39939.)PEP 616 for a full description. (Contributed by Dennis Sweeney in bpo-39939.)

Loại Generics Generics trong Bộ sưu tập tiêu chuẩn

Trong các chú thích loại, giờ đây bạn có thể sử dụng các loại thu thập tích hợp như

#if PY_VERSION_HEX >= 0x03090000
    // This was not needed before Python 3.9 (bpo-35810 and bpo-40217)
    if (base->tp_flags & Py_TPFLAGS_HEAPTYPE) {
        // a heap type's tp_traverse already visited Py_TYPE(self)
    } else {
        Py_VISIT(Py_TYPE(self));
    }
#else
0 và dict dưới dạng các loại chung thay vì nhập các loại được viết hoa tương ứng (ví dụ:
#if PY_VERSION_HEX >= 0x03090000
    // This was not needed before Python 3.9 (bpo-35810 and bpo-40217)
    if (base->tp_flags & Py_TPFLAGS_HEAPTYPE) {
        // a heap type's tp_traverse already visited Py_TYPE(self)
    } else {
        Py_VISIT(Py_TYPE(self));
    }
#else
2 hoặc
#if PY_VERSION_HEX >= 0x03090000
    // This was not needed before Python 3.9 (bpo-35810 and bpo-40217)
    if (base->tp_flags & Py_TPFLAGS_HEAPTYPE) {
        // a heap type's tp_traverse already visited Py_TYPE(self)
    } else {
        Py_VISIT(Py_TYPE(self));
    }
#else
3) từ
#if PY_VERSION_HEX >= 0x03090000
    // This was not needed before Python 3.9 (bpo-35810 and bpo-40217)
    if (base->tp_flags & Py_TPFLAGS_HEAPTYPE) {
        // a heap type's tp_traverse already visited Py_TYPE(self)
    } else {
        Py_VISIT(Py_TYPE(self));
    }
#else
4. Một số loại khác trong thư viện tiêu chuẩn hiện cũng chung chung, ví dụ
#if PY_VERSION_HEX >= 0x03090000
    // This was not needed before Python 3.9 (bpo-35810 and bpo-40217)
    if (base->tp_flags & Py_TPFLAGS_HEAPTYPE) {
        // a heap type's tp_traverse already visited Py_TYPE(self)
    } else {
        Py_VISIT(Py_TYPE(self));
    }
#else
5.

Example:

def greet_all(names: list[str]) -> None:
    for name in names:
        print("Hello", name)

Xem PEP 585 để biết thêm chi tiết. (Được đóng góp bởi Guido van Rossum, Ethan Smith và Batuhan Taşkaya trong BPO-39481.)PEP 585 for more details. (Contributed by Guido van Rossum, Ethan Smith, and Batuhan Taşkaya in bpo-39481.)

Trình phân tích cú pháp mới

Python 3.9 sử dụng trình phân tích cú pháp mới, dựa trên PEG thay vì LL (1). Hiệu suất của trình phân tích cú pháp mới gần như tương đương với trình phân tích cú pháp cũ, nhưng hình thức PEG linh hoạt hơn LL (1) khi thiết kế các tính năng ngôn ngữ mới. Chúng tôi sẽ bắt đầu sử dụng tính linh hoạt này trong Python 3.10 trở lên.

Mô -đun

>>> from zoneinfo import ZoneInfo
>>> from datetime import datetime, timedelta

>>> # Daylight saving time
>>> dt = datetime(2020, 10, 31, 12, tzinfo=ZoneInfo("America/Los_Angeles"))
>>> print(dt)
2020-10-31 12:00:00-07:00
>>> dt.tzname()
'PDT'

>>> # Standard time
>>> dt += timedelta(days=7)
>>> print(dt)
2020-11-07 12:00:00-08:00
>>> print(dt.tzname())
PST
5 sử dụng trình phân tích cú pháp mới và tạo ra AST giống như trình phân tích cú pháp cũ.

Trong Python 3.10, trình phân tích cú pháp cũ sẽ bị xóa và tất cả các chức năng sẽ phụ thuộc vào nó (chủ yếu là mô -đun

#if PY_VERSION_HEX >= 0x03090000
    // This was not needed before Python 3.9 (bpo-35810 and bpo-40217)
    if (base->tp_flags & Py_TPFLAGS_HEAPTYPE) {
        // a heap type's tp_traverse already visited Py_TYPE(self)
    } else {
        Py_VISIT(Py_TYPE(self));
    }
#else
7, từ lâu đã bị phản đối). Chỉ trong Python 3.9, bạn có thể quay lại trình phân tích cú pháp LL (1) bằng công tắc dòng lệnh (
#if PY_VERSION_HEX >= 0x03090000
    // This was not needed before Python 3.9 (bpo-35810 and bpo-40217)
    if (base->tp_flags & Py_TPFLAGS_HEAPTYPE) {
        // a heap type's tp_traverse already visited Py_TYPE(self)
    } else {
        Py_VISIT(Py_TYPE(self));
    }
#else
8) hoặc biến môi trường (
#if PY_VERSION_HEX >= 0x03090000
    // This was not needed before Python 3.9 (bpo-35810 and bpo-40217)
    if (base->tp_flags & Py_TPFLAGS_HEAPTYPE) {
        // a heap type's tp_traverse already visited Py_TYPE(self)
    } else {
        Py_VISIT(Py_TYPE(self));
    }
#else
9).

Xem PEP 617 để biết thêm chi tiết. (Được đóng góp bởi Guido van Rossum, Pablo Galindo và Lysandros Nikolaou trong BPO-40334.)PEP 617 for more details. (Contributed by Guido van Rossum, Pablo Galindo and Lysandros Nikolaou in bpo-40334.)

Thay đổi ngôn ngữ khác

  • >>> from typing import Literal
    >>> Literal[{0}]
    >>> Literal[{0}] == Literal[{False}]
    Traceback (most recent call last):
      File "", line 1, in 
    TypeError: unhashable type: 'set'
    
    0 bây giờ tăng
    >>> from typing import Literal
    >>> Literal[{0}]
    >>> Literal[{0}] == Literal[{False}]
    Traceback (most recent call last):
      File "", line 1, in 
    TypeError: unhashable type: 'set'
    
    1 thay vì
    >>> from typing import Literal
    >>> Literal[{0}]
    >>> Literal[{0}] == Literal[{False}]
    Traceback (most recent call last):
      File "", line 1, in 
    TypeError: unhashable type: 'set'
    
    2, đã từng xảy ra khi nhập khẩu tương đối đi qua gói cấp cao nhất của nó. (Được đóng góp bởi Ngalim Siregar trong BPO-37444.)

  • Python bây giờ có đường dẫn tuyệt đối của tên tệp tập lệnh được chỉ định trên dòng lệnh (ví dụ:

    >>> from typing import Literal
    >>> Literal[{0}]
    >>> Literal[{0}] == Literal[{False}]
    Traceback (most recent call last):
      File "", line 1, in 
    TypeError: unhashable type: 'set'
    
    3): thuộc tính
    >>> from typing import Literal
    >>> Literal[{0}]
    >>> Literal[{0}] == Literal[{False}]
    Traceback (most recent call last):
      File "", line 1, in 
    TypeError: unhashable type: 'set'
    
    4 của mô -đun
    >>> from typing import Literal
    >>> Literal[{0}]
    >>> Literal[{0}] == Literal[{False}]
    Traceback (most recent call last):
      File "", line 1, in 
    TypeError: unhashable type: 'set'
    
    5 trở thành một đường dẫn tuyệt đối, thay vì đường dẫn tương đối. Các đường dẫn này hiện vẫn còn hiệu lực sau khi thư mục hiện tại được thay đổi bởi
    >>> from typing import Literal
    >>> Literal[{0}]
    >>> Literal[{0}] == Literal[{False}]
    Traceback (most recent call last):
      File "", line 1, in 
    TypeError: unhashable type: 'set'
    
    6. Là một tác dụng phụ, Traceback cũng hiển thị đường dẫn tuyệt đối cho các khung mô -đun
    >>> from typing import Literal
    >>> Literal[{0}]
    >>> Literal[{0}] == Literal[{False}]
    Traceback (most recent call last):
      File "", line 1, in 
    TypeError: unhashable type: 'set'
    
    5 trong trường hợp này. (Được đóng góp bởi Victor Stinner trong BPO-20443.)

  • Trong chế độ phát triển Python và trong bản dựng gỡ lỗi, các đối số mã hóa và lỗi hiện được kiểm tra các hoạt động mã hóa và giải mã chuỗi. Ví dụ:

    >>> from typing import Literal
    >>> Literal[{0}]
    >>> Literal[{0}] == Literal[{False}]
    Traceback (most recent call last):
      File "", line 1, in 
    TypeError: unhashable type: 'set'
    
    8,
    >>> from typing import Literal
    >>> Literal[{0}]
    >>> Literal[{0}] == Literal[{False}]
    Traceback (most recent call last):
      File "", line 1, in 
    TypeError: unhashable type: 'set'
    
    9 và dict0.Python Development Mode and in debug build, the encoding and errors arguments are now checked for string encoding and decoding operations. Examples:
    >>> from typing import Literal
    >>> Literal[{0}]
    >>> Literal[{0}] == Literal[{False}]
    Traceback (most recent call last):
      File "", line 1, in 
    TypeError: unhashable type: 'set'
    
    8,
    >>> from typing import Literal
    >>> Literal[{0}]
    >>> Literal[{0}] == Literal[{False}]
    Traceback (most recent call last):
      File "", line 1, in 
    TypeError: unhashable type: 'set'
    
    9 and dict0.

    Theo mặc định, để có hiệu suất tốt nhất, đối số lỗi chỉ được kiểm tra ở lỗi mã hóa/giải mã đầu tiên và đối số mã hóa đôi khi bị bỏ qua đối với các chuỗi trống. (Được đóng góp bởi Victor Stinner trong BPO-37388.)

  • dict1 Bây giờ trả về dict2 thay vì một chuỗi trống cho tất cả các dict3 khác không. Bây giờ nó phù hợp với dict4. Có những thay đổi tương tự cho các đối tượng

    base->tp_traverse(self, visit, arg)
    
    7 và
    base->tp_traverse(self, visit, arg)
    
    8. (Được đóng góp bởi Serhiy Storchaka trong BPO-28029.)

  • Bất kỳ biểu thức hợp lệ bây giờ có thể được sử dụng như một người trang trí. Trước đây, ngữ pháp đã hạn chế hơn nhiều. Xem PEP 614 để biết chi tiết. (Được đóng góp bởi Brandt Bucher trong BPO-39702.)decorator. Previously, the grammar was much more restrictive. See PEP 614 for details. (Contributed by Brandt Bucher in bpo-39702.)

  • Cải thiện trợ giúp cho mô -đun

    #if PY_VERSION_HEX >= 0x03090000
        // This was not needed before Python 3.9 (bpo-35810 and bpo-40217)
        if (base->tp_flags & Py_TPFLAGS_HEAPTYPE) {
            // a heap type's tp_traverse already visited Py_TYPE(self)
        } else {
            Py_VISIT(Py_TYPE(self));
        }
    #else
    
    4. Docstrings hiện được hiển thị cho tất cả các hình thức đặc biệt và bí danh chung đặc biệt (như dict8 và
    #if PY_VERSION_HEX >= 0x03090000
        // This was not needed before Python 3.9 (bpo-35810 and bpo-40217)
        if (base->tp_flags & Py_TPFLAGS_HEAPTYPE) {
            // a heap type's tp_traverse already visited Py_TYPE(self)
        } else {
            Py_VISIT(Py_TYPE(self));
        }
    #else
    
    2). Sử dụng os.pidfd_open()0 với bí danh chung như os.pidfd_open()1 sẽ hiển thị sự trợ giúp cho loại bê tông tương ứng (
    #if PY_VERSION_HEX >= 0x03090000
        // This was not needed before Python 3.9 (bpo-35810 and bpo-40217)
        if (base->tp_flags & Py_TPFLAGS_HEAPTYPE) {
            // a heap type's tp_traverse already visited Py_TYPE(self)
        } else {
            Py_VISIT(Py_TYPE(self));
        }
    #else
    
    0 trong trường hợp này). (Được đóng góp bởi Serhiy Storchaka trong BPO-40257.)

  • Chạy song song os.pidfd_open()3 / os.pidfd_open()4 / os.pidfd_open()5 hiện bị cấm và os.pidfd_open()6 hiện phản ánh trạng thái chạy thực tế của trình tạo async. (Được đóng góp bởi Yury Selivanov trong BPO-30773.)

  • Các lỗi bất ngờ trong việc gọi phương thức os.pidfd_open()7 không còn bị che dấu bởi os.pidfd_open()8 trong toán tử os.pidfd_open()9 và các chức năng

    def greet_all(names: list[str]) -> None:
        for name in names:
            print("Hello", name)
    
    00,
    def greet_all(names: list[str]) -> None:
        for name in names:
            print("Hello", name)
    
    01 và
    def greet_all(names: list[str]) -> None:
        for name in names:
            print("Hello", name)
    
    02 của mô -đun
    >>> from zoneinfo import ZoneInfo
    >>> from datetime import datetime, timedelta
    
    >>> # Daylight saving time
    >>> dt = datetime(2020, 10, 31, 12, tzinfo=ZoneInfo("America/Los_Angeles"))
    >>> print(dt)
    2020-10-31 12:00:00-07:00
    >>> dt.tzname()
    'PDT'
    
    >>> # Standard time
    >>> dt += timedelta(days=7)
    >>> print(dt)
    2020-11-07 12:00:00-08:00
    >>> print(dt.tzname())
    PST
    
    0. (Được đóng góp bởi Serhiy Storchaka trong BPO-40824.)

  • Các biểu thức Lambda chưa được phép không còn có thể là phần biểu thức trong mệnh đề

    def greet_all(names: list[str]) -> None:
        for name in names:
            print("Hello", name)
    
    04 trong các biểu thức toàn diện và trình tạo. Xem BPO-41848 và BPO-43755 để biết chi tiết.

Mô -đun mới

Zoneinfo¶

Mô -đun

Python version                       3.4     3.5     3.6     3.7     3.8    3.9
--------------                       ---     ---     ---     ---     ---    ---

Variable and attribute read access:
    read_local                       7.1     7.1     5.4     5.1     3.9    3.9
    read_nonlocal                    7.1     8.1     5.8     5.4     4.4    4.5
    read_global                     15.5    19.0    14.3    13.6     7.6    7.8
    read_builtin                    21.1    21.6    18.5    19.0     7.5    7.8
    read_classvar_from_class        25.6    26.5    20.7    19.5    18.4   17.9
    read_classvar_from_instance     22.8    23.5    18.8    17.1    16.4   16.9
    read_instancevar                32.4    33.1    28.0    26.3    25.4   25.3
    read_instancevar_slots          27.8    31.3    20.8    20.8    20.2   20.5
    read_namedtuple                 73.8    57.5    45.0    46.8    18.4   18.7
    read_boundmethod                37.6    37.9    29.6    26.9    27.7   41.1

Variable and attribute write access:
    write_local                      8.7     9.3     5.5     5.3     4.3    4.3
    write_nonlocal                  10.5    11.1     5.6     5.5     4.7    4.8
    write_global                    19.7    21.2    18.0    18.0    15.8   16.7
    write_classvar                  92.9    96.0   104.6   102.1    39.2   39.8
    write_instancevar               44.6    45.8    40.0    38.9    35.5   37.4
    write_instancevar_slots         35.6    36.1    27.3    26.6    25.7   25.8

Data structure read access:
    read_list                       24.2    24.5    20.8    20.8    19.0   19.5
    read_deque                      24.7    25.5    20.2    20.6    19.8   20.2
    read_dict                       24.3    25.7    22.3    23.0    21.0   22.4
    read_strdict                    22.6    24.3    19.5    21.2    18.9   21.5

Data structure write access:
    write_list                      27.1    28.5    22.5    21.6    20.0   20.0
    write_deque                     28.7    30.1    22.7    21.8    23.5   21.7
    write_dict                      31.4    33.3    29.3    29.2    24.7   25.4
    write_strdict                   28.4    29.9    27.5    25.2    23.1   24.5

Stack (or queue) operations:
    list_append_pop                 93.4   112.7    75.4    74.2    50.8   50.6
    deque_append_pop                43.5    57.0    49.4    49.2    42.5   44.2
    deque_append_popleft            43.7    57.3    49.7    49.7    42.8   46.4

Timing loop:
    loop_overhead                    0.5     0.6     0.4     0.3     0.3    0.3
5 mang lại hỗ trợ cho cơ sở dữ liệu múi giờ IANA cho thư viện tiêu chuẩn. Nó thêm
def greet_all(names: list[str]) -> None:
    for name in names:
        print("Hello", name)
06, triển khai cụ thể
def greet_all(names: list[str]) -> None:
    for name in names:
        print("Hello", name)
07 được hỗ trợ bởi dữ liệu múi giờ của hệ thống.

Example:

>>> from zoneinfo import ZoneInfo
>>> from datetime import datetime, timedelta

>>> # Daylight saving time
>>> dt = datetime(2020, 10, 31, 12, tzinfo=ZoneInfo("America/Los_Angeles"))
>>> print(dt)
2020-10-31 12:00:00-07:00
>>> dt.tzname()
'PDT'

>>> # Standard time
>>> dt += timedelta(days=7)
>>> print(dt)
2020-11-07 12:00:00-08:00
>>> print(dt.tzname())
PST

Là một nguồn dữ liệu mùa thu cho các nền tảng không vận chuyển cơ sở dữ liệu IANA, mô-đun ____108 đã được phát hành dưới dạng gói của bên đầu tiên-được phân phối thông qua PYPI và được duy trì bởi nhóm Cpython Core.

Xem thêm

PEP 615 - Hỗ trợ cho cơ sở dữ liệu múi giờ IANA trong thư viện tiêu chuẩn – Support for the IANA Time Zone Database in the Standard Library

PEP được viết và thực hiện bởi Paul Ganssle

đồ họa

Một mô -đun mới,

Python version                       3.4     3.5     3.6     3.7     3.8    3.9
--------------                       ---     ---     ---     ---     ---    ---

Variable and attribute read access:
    read_local                       7.1     7.1     5.4     5.1     3.9    3.9
    read_nonlocal                    7.1     8.1     5.8     5.4     4.4    4.5
    read_global                     15.5    19.0    14.3    13.6     7.6    7.8
    read_builtin                    21.1    21.6    18.5    19.0     7.5    7.8
    read_classvar_from_class        25.6    26.5    20.7    19.5    18.4   17.9
    read_classvar_from_instance     22.8    23.5    18.8    17.1    16.4   16.9
    read_instancevar                32.4    33.1    28.0    26.3    25.4   25.3
    read_instancevar_slots          27.8    31.3    20.8    20.8    20.2   20.5
    read_namedtuple                 73.8    57.5    45.0    46.8    18.4   18.7
    read_boundmethod                37.6    37.9    29.6    26.9    27.7   41.1

Variable and attribute write access:
    write_local                      8.7     9.3     5.5     5.3     4.3    4.3
    write_nonlocal                  10.5    11.1     5.6     5.5     4.7    4.8
    write_global                    19.7    21.2    18.0    18.0    15.8   16.7
    write_classvar                  92.9    96.0   104.6   102.1    39.2   39.8
    write_instancevar               44.6    45.8    40.0    38.9    35.5   37.4
    write_instancevar_slots         35.6    36.1    27.3    26.6    25.7   25.8

Data structure read access:
    read_list                       24.2    24.5    20.8    20.8    19.0   19.5
    read_deque                      24.7    25.5    20.2    20.6    19.8   20.2
    read_dict                       24.3    25.7    22.3    23.0    21.0   22.4
    read_strdict                    22.6    24.3    19.5    21.2    18.9   21.5

Data structure write access:
    write_list                      27.1    28.5    22.5    21.6    20.0   20.0
    write_deque                     28.7    30.1    22.7    21.8    23.5   21.7
    write_dict                      31.4    33.3    29.3    29.2    24.7   25.4
    write_strdict                   28.4    29.9    27.5    25.2    23.1   24.5

Stack (or queue) operations:
    list_append_pop                 93.4   112.7    75.4    74.2    50.8   50.6
    deque_append_pop                43.5    57.0    49.4    49.2    42.5   44.2
    deque_append_popleft            43.7    57.3    49.7    49.7    42.8   46.4

Timing loop:
    loop_overhead                    0.5     0.6     0.4     0.3     0.3    0.3
6, đã được thêm vào có chứa lớp
def greet_all(names: list[str]) -> None:
    for name in names:
        print("Hello", name)
10 để cung cấp chức năng để thực hiện phân loại tô màu của các biểu đồ. (Được đóng góp bởi Pablo Galindo, Tim Peters và Larry Hastings trong BPO-17005.)

Các mô -đun được cải thiện

thuộc về Ast Ast

Đã thêm tùy chọn thụt vào

def greet_all(names: list[str]) -> None:
    for name in names:
        print("Hello", name)
11 cho phép nó tạo ra một đầu ra thụt đầu dòng. (Được đóng góp bởi Serhiy Storchaka trong BPO-37995.)

Đã thêm

def greet_all(names: list[str]) -> None:
    for name in names:
        print("Hello", name)
12 dưới dạng hàm trong mô -đun
>>> from zoneinfo import ZoneInfo
>>> from datetime import datetime, timedelta

>>> # Daylight saving time
>>> dt = datetime(2020, 10, 31, 12, tzinfo=ZoneInfo("America/Los_Angeles"))
>>> print(dt)
2020-10-31 12:00:00-07:00
>>> dt.tzname()
'PDT'

>>> # Standard time
>>> dt += timedelta(days=7)
>>> print(dt)
2020-11-07 12:00:00-08:00
>>> print(dt.tzname())
PST
5 có thể được sử dụng để không phân tách đối tượng
def greet_all(names: list[str]) -> None:
    for name in names:
        print("Hello", name)
14 và tạo một chuỗi có mã sẽ tạo ra một đối tượng
def greet_all(names: list[str]) -> None:
    for name in names:
        print("Hello", name)
14 tương đương khi được phân tích cú pháp. (Được đóng góp bởi Pablo Galindo và Batuhan Taskaya trong BPO-38870.)

Đã thêm Docstrings vào các nút AST chứa chữ ký ASDL được sử dụng để xây dựng nút đó. (Được đóng góp bởi Batuhan Taskaya trong BPO-39638.)

không đồng bộ

Do những lo ngại về bảo mật đáng kể, tham số reuse_address của

def greet_all(names: list[str]) -> None:
    for name in names:
        print("Hello", name)
16 không còn được hỗ trợ. Điều này là do hành vi của tùy chọn ổ cắm
def greet_all(names: list[str]) -> None:
    for name in names:
        print("Hello", name)
17 trong UDP. Để biết thêm chi tiết, xem tài liệu cho
def greet_all(names: list[str]) -> None:
    for name in names:
        print("Hello", name)
18. (Được đóng góp bởi Kyle Stanley, Antoine Pitrou và Yury Selivanov trong BPO-37228.)

Đã thêm một coroutine

def greet_all(names: list[str]) -> None:
    for name in names:
        print("Hello", name)
19 mới lên lịch tắt máy cho người thực thi mặc định chờ đợi trên
def greet_all(names: list[str]) -> None:
    for name in names:
        print("Hello", name)
20 để kết thúc kết thúc. Ngoài ra,
def greet_all(names: list[str]) -> None:
    for name in names:
        print("Hello", name)
21 đã được cập nhật để sử dụng coroutine mới. (Được đóng góp bởi Kyle Stanley trong BPO-34037.)coroutine
def greet_all(names: list[str]) -> None:
    for name in names:
        print("Hello", name)
19 that schedules a shutdown for the default executor that waits on the
def greet_all(names: list[str]) -> None:
    for name in names:
        print("Hello", name)
20 to finish closing. Also,
def greet_all(names: list[str]) -> None:
    for name in names:
        print("Hello", name)
21 has been updated to use the new coroutine. (Contributed by Kyle Stanley in bpo-34037.)

Đã thêm

def greet_all(names: list[str]) -> None:
    for name in names:
        print("Hello", name)
22, một triển khai người theo dõi trẻ em dành riêng cho Linux mà thăm dò các mô tả tệp xử lý. (BPO-38692)

Đã thêm một coroutine mới

def greet_all(names: list[str]) -> None:
    for name in names:
        print("Hello", name)
23. Nó chủ yếu được sử dụng để chạy các hàm ràng buộc IO trong một luồng riêng biệt để tránh chặn vòng lặp sự kiện và về cơ bản hoạt động như một phiên bản cấp cao của
def greet_all(names: list[str]) -> None:
    for name in names:
        print("Hello", name)
24 có thể trực tiếp lấy các đối số từ khóa. (Được đóng góp bởi Kyle Stanley và Yury Selivanov trong BPO-32309.)coroutine
def greet_all(names: list[str]) -> None:
    for name in names:
        print("Hello", name)
23. It is mainly used for running IO-bound functions in a separate thread to avoid blocking the event loop, and essentially works as a high-level version of
def greet_all(names: list[str]) -> None:
    for name in names:
        print("Hello", name)
24 that can directly take keyword arguments. (Contributed by Kyle Stanley and Yury Selivanov in bpo-32309.)

Khi hủy nhiệm vụ do thời gian chờ,

def greet_all(names: list[str]) -> None:
    for name in names:
        print("Hello", name)
25 bây giờ sẽ đợi cho đến khi việc hủy hoàn tất cũng trong trường hợp khi hết thời gian chờ

def greet_all(names: list[str]) -> None:
    for name in names:
        print("Hello", name)
26 Bây giờ tăng
def greet_all(names: list[str]) -> None:
    for name in names:
        print("Hello", name)
27 khi gọi các phương thức không tương thích với ổ cắm
def greet_all(names: list[str]) -> None:
    for name in names:
        print("Hello", name)
28. (Được đóng góp bởi IDO Michael trong BPO-37404.)

Compileall¶

Đã thêm khả năng mới để sử dụng các liên kết cứng cho các tệp

def greet_all(names: list[str]) -> None:
    for name in names:
        print("Hello", name)
29 sao chép: tham số HardLink_Dupes và tùy chọn dòng lệnh của HardLink_Dupes và Tùy chọn của HardHardLink-Dupes. (Được đóng góp bởi Lumír ‘Frenzy xông Balhar trong BPO-40495.)

Đã thêm các tùy chọn mới để thao tác đường dẫn trong các tệp

def greet_all(names: list[str]) -> None:
    for name in names:
        print("Hello", name)
29: StripDir, predDir, giới hạn_sl_dest tham số và -s, -p, -e Tùy chọn dòng lệnh. Đã thêm khả năng để chỉ định tùy chọn cho mức tối ưu hóa nhiều lần. (Được đóng góp bởi Lumír ‘Frenzy xông Balhar trong BPO-38112.)

đồng thời.

Đã thêm một tham số Hủy_Futures mới vào

def greet_all(names: list[str]) -> None:
    for name in names:
        print("Hello", name)
31 hủy bỏ tất cả các tương lai đang chờ xử lý chưa bắt đầu chạy, thay vì chờ chúng hoàn thành trước khi tắt người thực thi. (Được đóng góp bởi Kyle Stanley trong BPO-39349.)

Đã loại bỏ các luồng daemon khỏi

def greet_all(names: list[str]) -> None:
    for name in names:
        print("Hello", name)
20 và
def greet_all(names: list[str]) -> None:
    for name in names:
        print("Hello", name)
33. Điều này cải thiện khả năng tương thích với các yếu tố phụ và khả năng dự đoán trong các quy trình tắt máy của họ. (Được đóng góp bởi Kyle Stanley trong BPO-39812.)

Công nhân ở

def greet_all(names: list[str]) -> None:
    for name in names:
        print("Hello", name)
33 hiện được sinh ra theo yêu cầu, chỉ khi không có công nhân nhàn rỗi có sẵn để tái sử dụng. Điều này tối ưu hóa chi phí khởi động và giảm thời gian CPU bị mất cho những người lao động nhàn rỗi. (Được đóng góp bởi Kyle Stanley trong BPO-39207.)

lời nguyền rủa

Đã thêm

def greet_all(names: list[str]) -> None:
    for name in names:
        print("Hello", name)
35,
def greet_all(names: list[str]) -> None:
    for name in names:
        print("Hello", name)
36,
def greet_all(names: list[str]) -> None:
    for name in names:
        print("Hello", name)
37 và
def greet_all(names: list[str]) -> None:
    for name in names:
        print("Hello", name)
38. (Được đóng góp bởi Anthony Sottile trong BPO-38312.)

ngày giờ¶

def greet_all(names: list[str]) -> None:
    for name in names:
        print("Hello", name)
39 của
def greet_all(names: list[str]) -> None:
    for name in names:
        print("Hello", name)
40 và
def greet_all(names: list[str]) -> None:
    for name in names:
        print("Hello", name)
39 của các phương thức
def greet_all(names: list[str]) -> None:
    for name in names:
        print("Hello", name)
42 hiện trả về
def greet_all(names: list[str]) -> None:
    for name in names:
        print("Hello", name)
43 thay vì
def greet_all(names: list[str]) -> None:
    for name in names:
        print("Hello", name)
44. (Được đóng góp bởi Dong-hee NA trong BPO-24416.)

DisTutils¶

Lệnh tải lên hiện đang tạo ra các tiêu hóa băm SHA2-256 và BLAKE2B-256. Nó bỏ qua MD5 trên các nền tảng chặn MD5 Digest. (Được đóng góp bởi Christian Heimes trong BPO-40698.)upload command now creates SHA2-256 and Blake2b-256 hash digests. It skips MD5 on platforms that block MD5 digest. (Contributed by Christian Heimes in bpo-40698.)

fcntl¶

Đã thêm hằng số

def greet_all(names: list[str]) -> None:
    for name in names:
        print("Hello", name)
45,
def greet_all(names: list[str]) -> None:
    for name in names:
        print("Hello", name)
46 và
def greet_all(names: list[str]) -> None:
    for name in names:
        print("Hello", name)
47. (Được đóng góp bởi Dong-hee NA trong BPO-38602.)

ftplib¶

def greet_all(names: list[str]) -> None:
    for name in names:
        print("Hello", name)
48 và
def greet_all(names: list[str]) -> None:
    for name in names:
        print("Hello", name)
49 hiện tăng
>>> from typing import Literal
>>> Literal[{0}]
>>> Literal[{0}] == Literal[{False}]
Traceback (most recent call last):
  File "", line 1, in 
TypeError: unhashable type: 'set'
2 nếu thời gian chờ cho hàm tạo của chúng bằng không để ngăn chặn việc tạo ra một ổ cắm không chặn. (Được đóng góp bởi Dong-hee NA trong BPO-39259.)

GC¶

Khi người thu gom rác tạo ra một bộ sưu tập trong đó một số đối tượng hồi sinh (chúng có thể tiếp cận từ bên ngoài các chu kỳ bị cô lập sau khi các bộ đầu tiên được thực thi), không chặn bộ sưu tập của tất cả các đối tượng vẫn không thể truy cập được. (Được đóng góp bởi Pablo Galindo và Tim Peters trong BPO-38379.)

Đã thêm một chức năng mới

def greet_all(names: list[str]) -> None:
    for name in names:
        print("Hello", name)
51 để kiểm tra xem một đối tượng đã được hoàn thành bởi người thu gom rác. (Được đóng góp bởi Pablo Galindo trong BPO-39322.)

hăm hashlib

Mô -đun

def greet_all(names: list[str]) -> None:
    for name in names:
        print("Hello", name)
52 hiện có thể sử dụng băm SHA3 và lắc XOF từ OpenSSL khi có sẵn. (Được đóng góp bởi Christian Heimes trong BPO-37630.)

Các mô -đun băm tích hợp hiện có thể bị vô hiệu hóa với

def greet_all(names: list[str]) -> None:
    for name in names:
        print("Hello", name)
53 hoặc được kích hoạt có chọn lọc với ví dụ:
def greet_all(names: list[str]) -> None:
    for name in names:
        print("Hello", name)
54 để buộc sử dụng triển khai dựa trên OpenSSL. (Được đóng góp bởi Christian Heimes trong BPO-40479)

http¶

Mã trạng thái HTTP

def greet_all(names: list[str]) -> None:
    for name in names:
        print("Hello", name)
55,
def greet_all(names: list[str]) -> None:
    for name in names:
        print("Hello", name)
56 và
def greet_all(names: list[str]) -> None:
    for name in names:
        print("Hello", name)
57 được thêm vào
def greet_all(names: list[str]) -> None:
    for name in names:
        print("Hello", name)
58. (Được đóng góp bởi Dong-hee NA trong BPO-39509 và Ross Rhodes trong BPO-39507.)

Nhàn rỗi và idlelib¶

Đã thêm tùy chọn để chuyển đổi con trỏ nhấp nháy. (Được đóng góp bởi Zackery Spytz trong BPO-4603.)

Khóa thoát ngay bây giờ đóng cửa sổ hoàn thành nhàn rỗi. (Được đóng góp bởi Johnny Najera trong BPO-38944.)

Đã thêm từ khóa vào danh sách hoàn thành tên mô -đun. (Được đóng góp bởi Terry J. Reedy trong BPO-37765.)

Mới trong 3.9 Phát hành bảo trì

Làm cho Idle gọi

def greet_all(names: list[str]) -> None:
    for name in names:
        print("Hello", name)
59 (khi bắt đầu không có ‘-n,). Móc người dùng trước đây đã bị bỏ qua. (Được đóng góp bởi Ken Hilton trong BPO-43008.)

Những thay đổi ở trên đã được đưa ra để phát hành bảo trì 3,8.

Sắp xếp lại hộp thoại Cài đặt. Chia tab Chung thành các tab Windows và Shell/ED. Di chuyển các nguồn trợ giúp, mở rộng menu trợ giúp, sang tab Tiện ích mở rộng. Tạo không gian cho các tùy chọn mới và rút ngắn hộp thoại. Cái sau làm cho hộp thoại phù hợp hơn với màn hình nhỏ. (Được đóng góp bởi Terry Jan Reedy trong BPO-40468.) Di chuyển cài đặt không gian thụt lề từ tab Phông chữ sang tab Windows mới. (Được đóng góp bởi Mark Roseman và Terry Jan Reedy trong BPO-33962.)

Áp dụng cú pháp làm nổi bật vào các tệp

def greet_all(names: list[str]) -> None:
    for name in names:
        print("Hello", name)
60. (Được đóng góp bởi Alex Waygood và Terry Jan Reedy trong BPO-45447.)

imaplib¶

def greet_all(names: list[str]) -> None:
    for name in names:
        print("Hello", name)
61 và
def greet_all(names: list[str]) -> None:
    for name in names:
        print("Hello", name)
62 hiện có tham số thời gian chờ tùy chọn cho các hàm tạo của chúng. Ngoài ra, phương thức
>>> from typing import Literal
>>> Literal[{0}]
>>> Literal[{0}] == Literal[{False}]
Traceback (most recent call last):
  File "", line 1, in 
TypeError: unhashable type: 'set'
8 hiện có tham số thời gian chờ tùy chọn với thay đổi này. Các phương pháp được ghi đè của
def greet_all(names: list[str]) -> None:
    for name in names:
        print("Hello", name)
62 và
def greet_all(names: list[str]) -> None:
    for name in names:
        print("Hello", name)
65 đã được áp dụng cho thay đổi này. (Được đóng góp bởi Dong-hee NA trong BPO-38615.)

def greet_all(names: list[str]) -> None:
    for name in names:
        print("Hello", name)
66 được thêm vào.
def greet_all(names: list[str]) -> None:
    for name in names:
        print("Hello", name)
66 Giải phóng các tài nguyên máy chủ của máy chủ được liên kết với hộp thư được chọn và trả máy chủ về trạng thái xác thực. Lệnh này thực hiện các hành động tương tự như
def greet_all(names: list[str]) -> None:
    for name in names:
        print("Hello", name)
68, ngoại trừ không có tin nhắn nào bị xóa vĩnh viễn khỏi hộp thư hiện được chọn. (Được đóng góp bởi Dong-hee NA trong BPO-40375.)

nhập khẩu

Để cải thiện tính nhất quán với các báo cáo nhập khẩu,

def greet_all(names: list[str]) -> None:
    for name in names:
        print("Hello", name)
69 hiện tăng
>>> from typing import Literal
>>> Literal[{0}]
>>> Literal[{0}] == Literal[{False}]
Traceback (most recent call last):
  File "", line 1, in 
TypeError: unhashable type: 'set'
1 thay vì
>>> from typing import Literal
>>> Literal[{0}]
>>> Literal[{0}] == Literal[{False}]
Traceback (most recent call last):
  File "", line 1, in 
TypeError: unhashable type: 'set'
2 cho các nỗ lực nhập khẩu tương đối không hợp lệ. (Được đóng góp bởi Ngalim Siregar trong BPO-37444.)

Nhập trình tải nhập xuất bản các đối tượng mô -đun bất biến hiện có thể xuất bản các gói bất biến ngoài các mô -đun riêng lẻ. (Được đóng góp bởi Dino Viehland trong BPO-39336.)

Đã thêm chức năng

def greet_all(names: list[str]) -> None:
    for name in names:
        print("Hello", name)
72 với hỗ trợ cho các thư mục con trong dữ liệu gói, khớp backport trong
def greet_all(names: list[str]) -> None:
    for name in names:
        print("Hello", name)
73 phiên bản 1.5. (Được đóng góp bởi Jason R. Coombs trong BPO-39791.)

Được làm mới

def greet_all(names: list[str]) -> None:
    for name in names:
        print("Hello", name)
74 từ
def greet_all(names: list[str]) -> None:
    for name in names:
        print("Hello", name)
75 phiên bản 1.6.1.

quan sát¶

def greet_all(names: list[str]) -> None:
    for name in names:
        print("Hello", name)
76 được thay đổi từ
def greet_all(names: list[str]) -> None:
    for name in names:
        print("Hello", name)
77 thành Dict thông thường. (Được đóng góp bởi Inada Naoki trong BPO-36350 và BPO-39775.)

địa chỉ IP¶

def greet_all(names: list[str]) -> None:
    for name in names:
        print("Hello", name)
78 hiện hỗ trợ địa chỉ phạm vi IPv6 (địa chỉ IPv6 với hậu tố
def greet_all(names: list[str]) -> None:
    for name in names:
        print("Hello", name)
79).

Địa chỉ IPv6 có thể được phân tích cú pháp bằng cách sử dụng

def greet_all(names: list[str]) -> None:
    for name in names:
        print("Hello", name)
80. Nếu có, ID vùng phạm vi có sẵn thông qua thuộc tính
def greet_all(names: list[str]) -> None:
    for name in names:
        print("Hello", name)
81. (Được đóng góp bởi Oleksandr Pavliuk trong BPO-34788.)

Bắt đầu với Python 3.9.5 Mô -đun

def greet_all(names: list[str]) -> None:
    for name in names:
        print("Hello", name)
78 không còn chấp nhận bất kỳ số 0 hàng đầu nào trong chuỗi địa chỉ IPv4. (Được đóng góp bởi Christian Heimes trong BPO-36384).

môn Toán¶

Đã mở rộng chức năng

def greet_all(names: list[str]) -> None:
    for name in names:
        print("Hello", name)
83 để xử lý nhiều đối số. Trước đây, nó chỉ hỗ trợ hai cuộc tranh luận. (Được đóng góp bởi Serhiy Storchaka trong BPO-39648.)

Đã thêm

def greet_all(names: list[str]) -> None:
    for name in names:
        print("Hello", name)
84: Trả về bội số ít phổ biến nhất của các đối số được chỉ định. (Được đóng góp bởi Mark Dickinson, Ananthakrishnan và Serhiy Storchaka trong BPO-39479 và BPO-39648.)

Đã thêm

def greet_all(names: list[str]) -> None:
    for name in names:
        print("Hello", name)
85: Trả lại giá trị điểm nổi tiếp theo sau X về phía y. (Được đóng góp bởi Victor Stinner trong BPO-39288.)

Đã thêm

def greet_all(names: list[str]) -> None:
    for name in names:
        print("Hello", name)
86: Trả về giá trị của bit nổi ít nhất của một chiếc phao. (Được đóng góp bởi Victor Stinner trong BPO-39310.)

đa xử lý

Lớp

def greet_all(names: list[str]) -> None:
    for name in names:
        print("Hello", name)
87 có phương thức
def greet_all(names: list[str]) -> None:
    for name in names:
        print("Hello", name)
88 mới để đóng rõ ràng hàng đợi. (Được đóng góp bởi Victor Stinner trong BPO-30966.)

nntplib¶

def greet_all(names: list[str]) -> None:
    for name in names:
        print("Hello", name)
89 và
def greet_all(names: list[str]) -> None:
    for name in names:
        print("Hello", name)
90 hiện tăng
>>> from typing import Literal
>>> Literal[{0}]
>>> Literal[{0}] == Literal[{False}]
Traceback (most recent call last):
  File "", line 1, in 
TypeError: unhashable type: 'set'
2 nếu thời gian chờ cho hàm tạo của chúng bằng không để ngăn chặn việc tạo ra một ổ cắm không chặn. (Được đóng góp bởi Dong-hee NA trong BPO-39259.)

đường xoáy

Đã thêm

def greet_all(names: list[str]) -> None:
    for name in names:
        print("Hello", name)
92 và
def greet_all(names: list[str]) -> None:
    for name in names:
        print("Hello", name)
93 cho
def greet_all(names: list[str]) -> None:
    for name in names:
        print("Hello", name)
94. (Được đóng góp bởi Dong-hee NA trong BPO-38493.)

Phơi bày các ____99 (BPO-38692) và

def greet_all(names: list[str]) -> None:
    for name in names:
        print("Hello", name)
96 (BPO-38713) để quản lý quy trình với các mô tả tệp.

Hàm

def greet_all(names: list[str]) -> None:
    for name in names:
        print("Hello", name)
97 hiện cũng có sẵn trên Windows. (Được đóng góp bởi Victor Stinner trong BPO-39413.)

Các chức năng

def greet_all(names: list[str]) -> None:
    for name in names:
        print("Hello", name)
98 và
def greet_all(names: list[str]) -> None:
    for name in names:
        print("Hello", name)
97 hiện luôn có sẵn. (Được đóng góp bởi Victor Stinner trong BPO-39395.)

Đã thêm hàm

>>> from zoneinfo import ZoneInfo
>>> from datetime import datetime, timedelta

>>> # Daylight saving time
>>> dt = datetime(2020, 10, 31, 12, tzinfo=ZoneInfo("America/Los_Angeles"))
>>> print(dt)
2020-10-31 12:00:00-07:00
>>> dt.tzname()
'PDT'

>>> # Standard time
>>> dt += timedelta(days=7)
>>> print(dt)
2020-11-07 12:00:00-08:00
>>> print(dt.tzname())
PST
00: Chuyển đổi trạng thái chờ thành mã thoát. (Được đóng góp bởi Victor Stinner trong BPO-40094.)

Pathlib¶

Đã thêm

>>> from zoneinfo import ZoneInfo
>>> from datetime import datetime, timedelta

>>> # Daylight saving time
>>> dt = datetime(2020, 10, 31, 12, tzinfo=ZoneInfo("America/Los_Angeles"))
>>> print(dt)
2020-10-31 12:00:00-07:00
>>> dt.tzname()
'PDT'

>>> # Standard time
>>> dt += timedelta(days=7)
>>> print(dt)
2020-11-07 12:00:00-08:00
>>> print(dt.tzname())
PST
01 hoạt động tương tự như
>>> from zoneinfo import ZoneInfo
>>> from datetime import datetime, timedelta

>>> # Daylight saving time
>>> dt = datetime(2020, 10, 31, 12, tzinfo=ZoneInfo("America/Los_Angeles"))
>>> print(dt)
2020-10-31 12:00:00-07:00
>>> dt.tzname()
'PDT'

>>> # Standard time
>>> dt += timedelta(days=7)
>>> print(dt)
2020-11-07 12:00:00-08:00
>>> print(dt.tzname())
PST
02. (Được đóng góp bởi Girts Folkmanis trong BPO-30618)

PDB¶

Trên Windows Now

>>> from zoneinfo import ZoneInfo
>>> from datetime import datetime, timedelta

>>> # Daylight saving time
>>> dt = datetime(2020, 10, 31, 12, tzinfo=ZoneInfo("America/Los_Angeles"))
>>> print(dt)
2020-10-31 12:00:00-07:00
>>> dt.tzname()
'PDT'

>>> # Standard time
>>> dt += timedelta(days=7)
>>> print(dt)
2020-11-07 12:00:00-08:00
>>> print(dt.tzname())
PST
03 hỗ trợ
>>> from zoneinfo import ZoneInfo
>>> from datetime import datetime, timedelta

>>> # Daylight saving time
>>> dt = datetime(2020, 10, 31, 12, tzinfo=ZoneInfo("America/Los_Angeles"))
>>> print(dt)
2020-10-31 12:00:00-07:00
>>> dt.tzname()
'PDT'

>>> # Standard time
>>> dt += timedelta(days=7)
>>> print(dt)
2020-11-07 12:00:00-08:00
>>> print(dt.tzname())
PST
04. (Được đóng góp bởi Tim Hopper và Dan Lidral-Porter trong BPO-20523.)

cây poplib

>>> from zoneinfo import ZoneInfo
>>> from datetime import datetime, timedelta

>>> # Daylight saving time
>>> dt = datetime(2020, 10, 31, 12, tzinfo=ZoneInfo("America/Los_Angeles"))
>>> print(dt)
2020-10-31 12:00:00-07:00
>>> dt.tzname()
'PDT'

>>> # Standard time
>>> dt += timedelta(days=7)
>>> print(dt)
2020-11-07 12:00:00-08:00
>>> print(dt.tzname())
PST
05 và
>>> from zoneinfo import ZoneInfo
>>> from datetime import datetime, timedelta

>>> # Daylight saving time
>>> dt = datetime(2020, 10, 31, 12, tzinfo=ZoneInfo("America/Los_Angeles"))
>>> print(dt)
2020-10-31 12:00:00-07:00
>>> dt.tzname()
'PDT'

>>> # Standard time
>>> dt += timedelta(days=7)
>>> print(dt)
2020-11-07 12:00:00-08:00
>>> print(dt.tzname())
PST
06 hiện tăng
>>> from typing import Literal
>>> Literal[{0}]
>>> Literal[{0}] == Literal[{False}]
Traceback (most recent call last):
  File "", line 1, in 
TypeError: unhashable type: 'set'
2 nếu thời gian chờ cho hàm tạo của chúng bằng không để ngăn chặn việc tạo ra một ổ cắm không chặn. (Được đóng góp bởi Dong-hee NA trong BPO-39259.)

pprint¶

>>> from zoneinfo import ZoneInfo
>>> from datetime import datetime, timedelta

>>> # Daylight saving time
>>> dt = datetime(2020, 10, 31, 12, tzinfo=ZoneInfo("America/Los_Angeles"))
>>> print(dt)
2020-10-31 12:00:00-07:00
>>> dt.tzname()
'PDT'

>>> # Standard time
>>> dt += timedelta(days=7)
>>> print(dt)
2020-11-07 12:00:00-08:00
>>> print(dt.tzname())
PST
08 Bây giờ có thể in khá đẹp
>>> from zoneinfo import ZoneInfo
>>> from datetime import datetime, timedelta

>>> # Daylight saving time
>>> dt = datetime(2020, 10, 31, 12, tzinfo=ZoneInfo("America/Los_Angeles"))
>>> print(dt)
2020-10-31 12:00:00-07:00
>>> dt.tzname()
'PDT'

>>> # Standard time
>>> dt += timedelta(days=7)
>>> print(dt)
2020-11-07 12:00:00-08:00
>>> print(dt.tzname())
PST
09. (Được đóng góp bởi Carl Bordum Hansen trong BPO-37376.)

pydoc¶

Chuỗi tài liệu hiện được hiển thị không chỉ cho lớp, chức năng, phương thức, v.v., mà đối với bất kỳ đối tượng nào có thuộc tính

>>> from zoneinfo import ZoneInfo
>>> from datetime import datetime, timedelta

>>> # Daylight saving time
>>> dt = datetime(2020, 10, 31, 12, tzinfo=ZoneInfo("America/Los_Angeles"))
>>> print(dt)
2020-10-31 12:00:00-07:00
>>> dt.tzname()
'PDT'

>>> # Standard time
>>> dt += timedelta(days=7)
>>> print(dt)
2020-11-07 12:00:00-08:00
>>> print(dt.tzname())
PST
10 riêng. (Được đóng góp bởi Serhiy Storchaka trong BPO-40257.)

ngẫu nhiên¶

Đã thêm một phương thức

>>> from zoneinfo import ZoneInfo
>>> from datetime import datetime, timedelta

>>> # Daylight saving time
>>> dt = datetime(2020, 10, 31, 12, tzinfo=ZoneInfo("America/Los_Angeles"))
>>> print(dt)
2020-10-31 12:00:00-07:00
>>> dt.tzname()
'PDT'

>>> # Standard time
>>> dt += timedelta(days=7)
>>> print(dt)
2020-11-07 12:00:00-08:00
>>> print(dt.tzname())
PST
11 mới: Tạo các byte ngẫu nhiên. (Được đóng góp bởi Victor Stinner trong BPO-40286.)

dấu hiệu¶

Lộ

>>> from zoneinfo import ZoneInfo
>>> from datetime import datetime, timedelta

>>> # Daylight saving time
>>> dt = datetime(2020, 10, 31, 12, tzinfo=ZoneInfo("America/Los_Angeles"))
>>> print(dt)
2020-10-31 12:00:00-07:00
>>> dt.tzname()
'PDT'

>>> # Standard time
>>> dt += timedelta(days=7)
>>> print(dt)
2020-11-07 12:00:00-08:00
>>> print(dt.tzname())
PST
12 dành riêng cho Linux để gửi đến tín hiệu đến một quy trình bằng cách sử dụng bộ mô tả tệp thay vì PID. (BPO-38712)

smtplib¶

>>> from zoneinfo import ZoneInfo
>>> from datetime import datetime, timedelta

>>> # Daylight saving time
>>> dt = datetime(2020, 10, 31, 12, tzinfo=ZoneInfo("America/Los_Angeles"))
>>> print(dt)
2020-10-31 12:00:00-07:00
>>> dt.tzname()
'PDT'

>>> # Standard time
>>> dt += timedelta(days=7)
>>> print(dt)
2020-11-07 12:00:00-08:00
>>> print(dt.tzname())
PST
13 và
>>> from zoneinfo import ZoneInfo
>>> from datetime import datetime, timedelta

>>> # Daylight saving time
>>> dt = datetime(2020, 10, 31, 12, tzinfo=ZoneInfo("America/Los_Angeles"))
>>> print(dt)
2020-10-31 12:00:00-07:00
>>> dt.tzname()
'PDT'

>>> # Standard time
>>> dt += timedelta(days=7)
>>> print(dt)
2020-11-07 12:00:00-08:00
>>> print(dt.tzname())
PST
14 hiện tăng
>>> from typing import Literal
>>> Literal[{0}]
>>> Literal[{0}] == Literal[{False}]
Traceback (most recent call last):
  File "", line 1, in 
TypeError: unhashable type: 'set'
2 nếu thời gian chờ cho hàm tạo của chúng bằng không để ngăn chặn việc tạo ra một ổ cắm không chặn. (Được đóng góp bởi Dong-hee NA trong BPO-39259.)

>>> from zoneinfo import ZoneInfo
>>> from datetime import datetime, timedelta

>>> # Daylight saving time
>>> dt = datetime(2020, 10, 31, 12, tzinfo=ZoneInfo("America/Los_Angeles"))
>>> print(dt)
2020-10-31 12:00:00-07:00
>>> dt.tzname()
'PDT'

>>> # Standard time
>>> dt += timedelta(days=7)
>>> print(dt)
2020-11-07 12:00:00-08:00
>>> print(dt.tzname())
PST
16 Constructor hiện có tham số thời gian chờ tùy chọn. (Được đóng góp bởi Dong-hee NA trong BPO-39329.)

ổ cắm¶

Mô -đun

>>> from zoneinfo import ZoneInfo
>>> from datetime import datetime, timedelta

>>> # Daylight saving time
>>> dt = datetime(2020, 10, 31, 12, tzinfo=ZoneInfo("America/Los_Angeles"))
>>> print(dt)
2020-10-31 12:00:00-07:00
>>> dt.tzname()
'PDT'

>>> # Standard time
>>> dt += timedelta(days=7)
>>> print(dt)
2020-11-07 12:00:00-08:00
>>> print(dt.tzname())
PST
17 hiện xuất xuất hằng số
>>> from zoneinfo import ZoneInfo
>>> from datetime import datetime, timedelta

>>> # Daylight saving time
>>> dt = datetime(2020, 10, 31, 12, tzinfo=ZoneInfo("America/Los_Angeles"))
>>> print(dt)
2020-10-31 12:00:00-07:00
>>> dt.tzname()
'PDT'

>>> # Standard time
>>> dt += timedelta(days=7)
>>> print(dt)
2020-11-07 12:00:00-08:00
>>> print(dt.tzname())
PST
18 trên Linux 4.1 và lớn hơn. (Được đóng góp bởi Stefan Tatschner và Zackery Spytz trong BPO-25780.)

Mô -đun ổ cắm hiện hỗ trợ giao thức

>>> from zoneinfo import ZoneInfo
>>> from datetime import datetime, timedelta

>>> # Daylight saving time
>>> dt = datetime(2020, 10, 31, 12, tzinfo=ZoneInfo("America/Los_Angeles"))
>>> print(dt)
2020-10-31 12:00:00-07:00
>>> dt.tzname()
'PDT'

>>> # Standard time
>>> dt += timedelta(days=7)
>>> print(dt)
2020-11-07 12:00:00-08:00
>>> print(dt.tzname())
PST
19 trên các nền tảng hỗ trợ nó. (Được đóng góp bởi Karl ding trong BPO-40291.)

Mô -đun ổ cắm hiện có các hàm

>>> from zoneinfo import ZoneInfo
>>> from datetime import datetime, timedelta

>>> # Daylight saving time
>>> dt = datetime(2020, 10, 31, 12, tzinfo=ZoneInfo("America/Los_Angeles"))
>>> print(dt)
2020-10-31 12:00:00-07:00
>>> dt.tzname()
'PDT'

>>> # Standard time
>>> dt += timedelta(days=7)
>>> print(dt)
2020-11-07 12:00:00-08:00
>>> print(dt.tzname())
PST
20 và
>>> from zoneinfo import ZoneInfo
>>> from datetime import datetime, timedelta

>>> # Daylight saving time
>>> dt = datetime(2020, 10, 31, 12, tzinfo=ZoneInfo("America/Los_Angeles"))
>>> print(dt)
2020-10-31 12:00:00-07:00
>>> dt.tzname()
'PDT'

>>> # Standard time
>>> dt += timedelta(days=7)
>>> print(dt)
2020-11-07 12:00:00-08:00
>>> print(dt.tzname())
PST
21. (Được đóng góp bởi Joannah Nanjekye, Shinya Okano và Victor Stinner trong BPO-28724.)

thời gian¶

Trên AIX,

>>> from zoneinfo import ZoneInfo
>>> from datetime import datetime, timedelta

>>> # Daylight saving time
>>> dt = datetime(2020, 10, 31, 12, tzinfo=ZoneInfo("America/Los_Angeles"))
>>> print(dt)
2020-10-31 12:00:00-07:00
>>> dt.tzname()
'PDT'

>>> # Standard time
>>> dt += timedelta(days=7)
>>> print(dt)
2020-11-07 12:00:00-08:00
>>> print(dt.tzname())
PST
22 hiện được triển khai với
>>> from zoneinfo import ZoneInfo
>>> from datetime import datetime, timedelta

>>> # Daylight saving time
>>> dt = datetime(2020, 10, 31, 12, tzinfo=ZoneInfo("America/Los_Angeles"))
>>> print(dt)
2020-10-31 12:00:00-07:00
>>> dt.tzname()
'PDT'

>>> # Standard time
>>> dt += timedelta(days=7)
>>> print(dt)
2020-11-07 12:00:00-08:00
>>> print(dt.tzname())
PST
23 có độ phân giải nano giây, thay vì
>>> from zoneinfo import ZoneInfo
>>> from datetime import datetime, timedelta

>>> # Daylight saving time
>>> dt = datetime(2020, 10, 31, 12, tzinfo=ZoneInfo("America/Los_Angeles"))
>>> print(dt)
2020-10-31 12:00:00-07:00
>>> dt.tzname()
'PDT'

>>> # Standard time
>>> dt += timedelta(days=7)
>>> print(dt)
2020-11-07 12:00:00-08:00
>>> print(dt.tzname())
PST
24 có độ phân giải 10 mili giây. (Được đóng góp bởi Batuhan Taskaya trong BPO-40192)

sys¶

Đã thêm một thuộc tính

>>> from zoneinfo import ZoneInfo
>>> from datetime import datetime, timedelta

>>> # Daylight saving time
>>> dt = datetime(2020, 10, 31, 12, tzinfo=ZoneInfo("America/Los_Angeles"))
>>> print(dt)
2020-10-31 12:00:00-07:00
>>> dt.tzname()
'PDT'

>>> # Standard time
>>> dt += timedelta(days=7)
>>> print(dt)
2020-11-07 12:00:00-08:00
>>> print(dt.tzname())
PST
25 mới: Tên của thư mục thư viện cụ thể nền tảng. Nó được sử dụng để xây dựng đường dẫn của thư viện tiêu chuẩn và các đường dẫn của các mô -đun mở rộng được cài đặt. Nó bằng
>>> from zoneinfo import ZoneInfo
>>> from datetime import datetime, timedelta

>>> # Daylight saving time
>>> dt = datetime(2020, 10, 31, 12, tzinfo=ZoneInfo("America/Los_Angeles"))
>>> print(dt)
2020-10-31 12:00:00-07:00
>>> dt.tzname()
'PDT'

>>> # Standard time
>>> dt += timedelta(days=7)
>>> print(dt)
2020-11-07 12:00:00-08:00
>>> print(dt.tzname())
PST
26 trên hầu hết các nền tảng. Trên Fedora và Suse, nó bằng
>>> from zoneinfo import ZoneInfo
>>> from datetime import datetime, timedelta

>>> # Daylight saving time
>>> dt = datetime(2020, 10, 31, 12, tzinfo=ZoneInfo("America/Los_Angeles"))
>>> print(dt)
2020-10-31 12:00:00-07:00
>>> dt.tzname()
'PDT'

>>> # Standard time
>>> dt += timedelta(days=7)
>>> print(dt)
2020-11-07 12:00:00-08:00
>>> print(dt.tzname())
PST
27 trên các nền tảng 64 bit. .

Trước đây,

>>> from zoneinfo import ZoneInfo
>>> from datetime import datetime, timedelta

>>> # Daylight saving time
>>> dt = datetime(2020, 10, 31, 12, tzinfo=ZoneInfo("America/Los_Angeles"))
>>> print(dt)
2020-10-31 12:00:00-07:00
>>> dt.tzname()
'PDT'

>>> # Standard time
>>> dt += timedelta(days=7)
>>> print(dt)
2020-11-07 12:00:00-08:00
>>> print(dt.tzname())
PST
28 đã bị chặn khi không tương tác. Bây giờ
>>> from zoneinfo import ZoneInfo
>>> from datetime import datetime, timedelta

>>> # Daylight saving time
>>> dt = datetime(2020, 10, 31, 12, tzinfo=ZoneInfo("America/Los_Angeles"))
>>> print(dt)
2020-10-31 12:00:00-07:00
>>> dt.tzname()
'PDT'

>>> # Standard time
>>> dt += timedelta(days=7)
>>> print(dt)
2020-11-07 12:00:00-08:00
>>> print(dt.tzname())
PST
29 mặc định luôn luôn được đệm. (Được đóng góp bởi Jendrik Seipp trong BPO-13601.)

tracemalloc¶

Đã thêm

>>> from zoneinfo import ZoneInfo
>>> from datetime import datetime, timedelta

>>> # Daylight saving time
>>> dt = datetime(2020, 10, 31, 12, tzinfo=ZoneInfo("America/Los_Angeles"))
>>> print(dt)
2020-10-31 12:00:00-07:00
>>> dt.tzname()
'PDT'

>>> # Standard time
>>> dt += timedelta(days=7)
>>> print(dt)
2020-11-07 12:00:00-08:00
>>> print(dt.tzname())
PST
30 để đặt kích thước cực đại của các khối bộ nhớ theo dõi thành kích thước hiện tại, để đo cực đại của các đoạn mã cụ thể. (Được đóng góp bởi Huon Wilson trong BPO-40630.)

đánh máy¶

PEP 593 đã giới thiệu một loại

>>> from zoneinfo import ZoneInfo
>>> from datetime import datetime, timedelta

>>> # Daylight saving time
>>> dt = datetime(2020, 10, 31, 12, tzinfo=ZoneInfo("America/Los_Angeles"))
>>> print(dt)
2020-10-31 12:00:00-07:00
>>> dt.tzname()
'PDT'

>>> # Standard time
>>> dt += timedelta(days=7)
>>> print(dt)
2020-11-07 12:00:00-08:00
>>> print(dt.tzname())
PST
31 để trang trí các loại hiện có với siêu dữ liệu cụ thể theo ngữ cảnh và tham số
>>> from zoneinfo import ZoneInfo
>>> from datetime import datetime, timedelta

>>> # Daylight saving time
>>> dt = datetime(2020, 10, 31, 12, tzinfo=ZoneInfo("America/Los_Angeles"))
>>> print(dt)
2020-10-31 12:00:00-07:00
>>> dt.tzname()
'PDT'

>>> # Standard time
>>> dt += timedelta(days=7)
>>> print(dt)
2020-11-07 12:00:00-08:00
>>> print(dt.tzname())
PST
32 mới thành
>>> from zoneinfo import ZoneInfo
>>> from datetime import datetime, timedelta

>>> # Daylight saving time
>>> dt = datetime(2020, 10, 31, 12, tzinfo=ZoneInfo("America/Los_Angeles"))
>>> print(dt)
2020-10-31 12:00:00-07:00
>>> dt.tzname()
'PDT'

>>> # Standard time
>>> dt += timedelta(days=7)
>>> print(dt)
2020-11-07 12:00:00-08:00
>>> print(dt.tzname())
PST
33 để truy cập siêu dữ liệu khi chạy. (Được đóng góp bởi Till Varoquaux và Konstantin Kashin.)
introduced an
>>> from zoneinfo import ZoneInfo
>>> from datetime import datetime, timedelta

>>> # Daylight saving time
>>> dt = datetime(2020, 10, 31, 12, tzinfo=ZoneInfo("America/Los_Angeles"))
>>> print(dt)
2020-10-31 12:00:00-07:00
>>> dt.tzname()
'PDT'

>>> # Standard time
>>> dt += timedelta(days=7)
>>> print(dt)
2020-11-07 12:00:00-08:00
>>> print(dt.tzname())
PST
31 type to decorate existing types with context-specific metadata and new
>>> from zoneinfo import ZoneInfo
>>> from datetime import datetime, timedelta

>>> # Daylight saving time
>>> dt = datetime(2020, 10, 31, 12, tzinfo=ZoneInfo("America/Los_Angeles"))
>>> print(dt)
2020-10-31 12:00:00-07:00
>>> dt.tzname()
'PDT'

>>> # Standard time
>>> dt += timedelta(days=7)
>>> print(dt)
2020-11-07 12:00:00-08:00
>>> print(dt.tzname())
PST
32 parameter to
>>> from zoneinfo import ZoneInfo
>>> from datetime import datetime, timedelta

>>> # Daylight saving time
>>> dt = datetime(2020, 10, 31, 12, tzinfo=ZoneInfo("America/Los_Angeles"))
>>> print(dt)
2020-10-31 12:00:00-07:00
>>> dt.tzname()
'PDT'

>>> # Standard time
>>> dt += timedelta(days=7)
>>> print(dt)
2020-11-07 12:00:00-08:00
>>> print(dt.tzname())
PST
33 to access the metadata at runtime. (Contributed by Till Varoquaux and Konstantin Kashin.)

unicodedata¶

Cơ sở dữ liệu Unicode đã được cập nhật lên phiên bản 13.0.0. (BPO-39926).

venv¶

Các tập lệnh kích hoạt được cung cấp bởi

>>> from zoneinfo import ZoneInfo
>>> from datetime import datetime, timedelta

>>> # Daylight saving time
>>> dt = datetime(2020, 10, 31, 12, tzinfo=ZoneInfo("America/Los_Angeles"))
>>> print(dt)
2020-10-31 12:00:00-07:00
>>> dt.tzname()
'PDT'

>>> # Standard time
>>> dt += timedelta(days=7)
>>> print(dt)
2020-11-07 12:00:00-08:00
>>> print(dt.tzname())
PST
34 Bây giờ tất cả chỉ định tùy chỉnh nhanh chóng của chúng một cách nhất quán bằng cách luôn sử dụng giá trị được chỉ định bởi
>>> from zoneinfo import ZoneInfo
>>> from datetime import datetime, timedelta

>>> # Daylight saving time
>>> dt = datetime(2020, 10, 31, 12, tzinfo=ZoneInfo("America/Los_Angeles"))
>>> print(dt)
2020-10-31 12:00:00-07:00
>>> dt.tzname()
'PDT'

>>> # Standard time
>>> dt += timedelta(days=7)
>>> print(dt)
2020-11-07 12:00:00-08:00
>>> print(dt.tzname())
PST
35. Trước đây, một số tập lệnh được sử dụng vô điều kiện
>>> from zoneinfo import ZoneInfo
>>> from datetime import datetime, timedelta

>>> # Daylight saving time
>>> dt = datetime(2020, 10, 31, 12, tzinfo=ZoneInfo("America/Los_Angeles"))
>>> print(dt)
2020-10-31 12:00:00-07:00
>>> dt.tzname()
'PDT'

>>> # Standard time
>>> dt += timedelta(days=7)
>>> print(dt)
2020-11-07 12:00:00-08:00
>>> print(dt.tzname())
PST
35, một số khác chỉ khi nó được đặt (đó là trường hợp mặc định) và thay vào đó, một kịch bản được sử dụng. (Được đóng góp bởi Brett Cannon trong BPO-37663.)

xml¶

Các ký tự không gian trắng trong các thuộc tính hiện được bảo tồn khi tuần tự hóa

>>> from zoneinfo import ZoneInfo
>>> from datetime import datetime, timedelta

>>> # Daylight saving time
>>> dt = datetime(2020, 10, 31, 12, tzinfo=ZoneInfo("America/Los_Angeles"))
>>> print(dt)
2020-10-31 12:00:00-07:00
>>> dt.tzname()
'PDT'

>>> # Standard time
>>> dt += timedelta(days=7)
>>> print(dt)
2020-11-07 12:00:00-08:00
>>> print(dt.tzname())
PST
38 sang tệp XML. Eolns không còn được chuẩn hóa thành từ N N. Đây là kết quả của cuộc thảo luận về cách diễn giải Phần 2.11 của Spec XML. (Được đóng góp bởi Mefistotelis trong BPO-39011.)

Tối ưu hóa Or

  • Tối ưu hóa thành ngữ để gán một biến tạm thời trong toàn bộ. Bây giờ

    >>> from zoneinfo import ZoneInfo
    >>> from datetime import datetime, timedelta
    
    >>> # Daylight saving time
    >>> dt = datetime(2020, 10, 31, 12, tzinfo=ZoneInfo("America/Los_Angeles"))
    >>> print(dt)
    2020-10-31 12:00:00-07:00
    >>> dt.tzname()
    'PDT'
    
    >>> # Standard time
    >>> dt += timedelta(days=7)
    >>> print(dt)
    2020-11-07 12:00:00-08:00
    >>> print(dt.tzname())
    PST
    
    39 trong toàn bộ là nhanh như một nhiệm vụ đơn giản
    >>> from zoneinfo import ZoneInfo
    >>> from datetime import datetime, timedelta
    
    >>> # Daylight saving time
    >>> dt = datetime(2020, 10, 31, 12, tzinfo=ZoneInfo("America/Los_Angeles"))
    >>> print(dt)
    2020-10-31 12:00:00-07:00
    >>> dt.tzname()
    'PDT'
    
    >>> # Standard time
    >>> dt += timedelta(days=7)
    >>> print(dt)
    2020-11-07 12:00:00-08:00
    >>> print(dt.tzname())
    PST
    
    40. Ví dụ:

    sums = [s cho s trong [0] cho x trong dữ liệu cho s trong [s + x]]]

    Không giống như toán tử

    >>> from zoneinfo import ZoneInfo
    >>> from datetime import datetime, timedelta
    
    >>> # Daylight saving time
    >>> dt = datetime(2020, 10, 31, 12, tzinfo=ZoneInfo("America/Los_Angeles"))
    >>> print(dt)
    2020-10-31 12:00:00-07:00
    >>> dt.tzname()
    'PDT'
    
    >>> # Standard time
    >>> dt += timedelta(days=7)
    >>> print(dt)
    2020-11-07 12:00:00-08:00
    >>> print(dt.tzname())
    PST
    
    41, thành ngữ này không rò rỉ một biến cho phạm vi bên ngoài.

    (Được đóng góp bởi Serhiy Storchaka trong BPO-32856.)

  • Xử lý tín hiệu tối ưu hóa trong các ứng dụng đa luồng. Nếu một luồng khác với luồng chính nhận được tín hiệu, vòng đánh giá bytecode không còn bị gián đoạn ở mỗi hướng dẫn mã byte để kiểm tra các tín hiệu đang chờ xử lý không thể xử lý. Chỉ chủ đề chính của trình thông dịch chính mới có thể xử lý tín hiệu.

    Trước đây, vòng đánh giá bytecode đã bị gián đoạn ở mỗi lệnh cho đến khi luồng chính xử lý tín hiệu. (Được đóng góp bởi Victor Stinner trong BPO-40010.)

  • Tối ưu hóa mô -đun

    >>> from zoneinfo import ZoneInfo
    >>> from datetime import datetime, timedelta
    
    >>> # Daylight saving time
    >>> dt = datetime(2020, 10, 31, 12, tzinfo=ZoneInfo("America/Los_Angeles"))
    >>> print(dt)
    2020-10-31 12:00:00-07:00
    >>> dt.tzname()
    'PDT'
    
    >>> # Standard time
    >>> dt += timedelta(days=7)
    >>> print(dt)
    2020-11-07 12:00:00-08:00
    >>> print(dt.tzname())
    PST
    
    42 trên FreeBSD bằng cách sử dụng
    >>> from zoneinfo import ZoneInfo
    >>> from datetime import datetime, timedelta
    
    >>> # Daylight saving time
    >>> dt = datetime(2020, 10, 31, 12, tzinfo=ZoneInfo("America/Los_Angeles"))
    >>> print(dt)
    2020-10-31 12:00:00-07:00
    >>> dt.tzname()
    'PDT'
    
    >>> # Standard time
    >>> dt += timedelta(days=7)
    >>> print(dt)
    2020-11-07 12:00:00-08:00
    >>> print(dt.tzname())
    PST
    
    43. (Được đóng góp bởi Ed Maste, Conrad Meyer, Kyle Evans, Kubilay Kocak và Victor Stinner trong BPO-38061.)

  • >>> from zoneinfo import ZoneInfo
    >>> from datetime import datetime, timedelta
    
    >>> # Daylight saving time
    >>> dt = datetime(2020, 10, 31, 12, tzinfo=ZoneInfo("America/Los_Angeles"))
    >>> print(dt)
    2020-10-31 12:00:00-07:00
    >>> dt.tzname()
    'PDT'
    
    >>> # Standard time
    >>> dt += timedelta(days=7)
    >>> print(dt)
    2020-11-07 12:00:00-08:00
    >>> print(dt.tzname())
    PST
    
    44 hiện nhanh hơn tới 1,87 lần cho các giá trị phù hợp với dài. (Được đóng góp bởi Sergey Fedosev trong BPO-37986.)long. (Contributed by Sergey Fedoseev in bpo-37986.)

  • Một số python xây dựng (

    >>> from zoneinfo import ZoneInfo
    >>> from datetime import datetime, timedelta
    
    >>> # Daylight saving time
    >>> dt = datetime(2020, 10, 31, 12, tzinfo=ZoneInfo("America/Los_Angeles"))
    >>> print(dt)
    2020-10-31 12:00:00-07:00
    >>> dt.tzname()
    'PDT'
    
    >>> # Standard time
    >>> dt += timedelta(days=7)
    >>> print(dt)
    2020-11-07 12:00:00-08:00
    >>> print(dt.tzname())
    PST
    
    45,
    def greet_all(names: list[str]) -> None:
        for name in names:
            print("Hello", name)
    
    44,
    >>> from zoneinfo import ZoneInfo
    >>> from datetime import datetime, timedelta
    
    >>> # Daylight saving time
    >>> dt = datetime(2020, 10, 31, 12, tzinfo=ZoneInfo("America/Los_Angeles"))
    >>> print(dt)
    2020-10-31 12:00:00-07:00
    >>> dt.tzname()
    'PDT'
    
    >>> # Standard time
    >>> dt += timedelta(days=7)
    >>> print(dt)
    2020-11-07 12:00:00-08:00
    >>> print(dt.tzname())
    PST
    
    47,
    >>> from zoneinfo import ZoneInfo
    >>> from datetime import datetime, timedelta
    
    >>> # Daylight saving time
    >>> dt = datetime(2020, 10, 31, 12, tzinfo=ZoneInfo("America/Los_Angeles"))
    >>> print(dt)
    2020-10-31 12:00:00-07:00
    >>> dt.tzname()
    'PDT'
    
    >>> # Standard time
    >>> dt += timedelta(days=7)
    >>> print(dt)
    2020-11-07 12:00:00-08:00
    >>> print(dt.tzname())
    PST
    
    48,
    #if PY_VERSION_HEX >= 0x03090000
        // This was not needed before Python 3.9 (bpo-35810 and bpo-40217)
        if (base->tp_flags & Py_TPFLAGS_HEAPTYPE) {
            // a heap type's tp_traverse already visited Py_TYPE(self)
        } else {
            Py_VISIT(Py_TYPE(self));
        }
    #else
    
    0, dict) hiện được tăng tốc bằng cách sử dụng giao thức VectorCall PEP 590. (Được đóng góp bởi Dong-hee NA, Mark Shannon, Jeroen Demeyer và Petr Viktorin trong BPO-37207.)PEP 590 vectorcall protocol. (Contributed by Dong-hee Na, Mark Shannon, Jeroen Demeyer and Petr Viktorin in bpo-37207.)

  • Tối ưu hóa

    >>> from zoneinfo import ZoneInfo
    >>> from datetime import datetime, timedelta
    
    >>> # Daylight saving time
    >>> dt = datetime(2020, 10, 31, 12, tzinfo=ZoneInfo("America/Los_Angeles"))
    >>> print(dt)
    2020-10-31 12:00:00-07:00
    >>> dt.tzname()
    'PDT'
    
    >>> # Standard time
    >>> dt += timedelta(days=7)
    >>> print(dt)
    2020-11-07 12:00:00-08:00
    >>> print(dt.tzname())
    PST
    
    51 cho trường hợp khi bộ khác lớn hơn nhiều so với bộ cơ sở. (Được đề xuất bởi Evgeny Kapun với mã được đóng góp bởi Michele Orrù trong BPO-8425.)

  • Trình phân bổ đối tượng nhỏ Python sườn (

    >>> from zoneinfo import ZoneInfo
    >>> from datetime import datetime, timedelta
    
    >>> # Daylight saving time
    >>> dt = datetime(2020, 10, 31, 12, tzinfo=ZoneInfo("America/Los_Angeles"))
    >>> print(dt)
    2020-10-31 12:00:00-07:00
    >>> dt.tzname()
    'PDT'
    
    >>> # Standard time
    >>> dt += timedelta(days=7)
    >>> print(dt)
    2020-11-07 12:00:00-08:00
    >>> print(dt.tzname())
    PST
    
    52) hiện cho phép (không nhiều hơn) một đấu trường trống để duy trì để tái sử dụng ngay lập tức, mà không trả lại cho HĐH. Điều này ngăn chặn việc đánh vào các vòng đơn giản, nơi một đấu trường có thể được tạo ra và phá hủy một lần nữa trên mỗi lần lặp. (Được đóng góp bởi Tim Peters trong BPO-37257.)

  • phân chia sàn hoạt động float hiện có hiệu suất tốt hơn. Ngoài ra, thông điệp của

    >>> from zoneinfo import ZoneInfo
    >>> from datetime import datetime, timedelta
    
    >>> # Daylight saving time
    >>> dt = datetime(2020, 10, 31, 12, tzinfo=ZoneInfo("America/Los_Angeles"))
    >>> print(dt)
    2020-10-31 12:00:00-07:00
    >>> dt.tzname()
    'PDT'
    
    >>> # Standard time
    >>> dt += timedelta(days=7)
    >>> print(dt)
    2020-11-07 12:00:00-08:00
    >>> print(dt.tzname())
    PST
    
    53 cho hoạt động này được cập nhật. (Được đóng góp bởi Dong-hee NA trong BPO-39434.) of float operation now has a better performance. Also the message of
    >>> from zoneinfo import ZoneInfo
    >>> from datetime import datetime, timedelta
    
    >>> # Daylight saving time
    >>> dt = datetime(2020, 10, 31, 12, tzinfo=ZoneInfo("America/Los_Angeles"))
    >>> print(dt)
    2020-10-31 12:00:00-07:00
    >>> dt.tzname()
    'PDT'
    
    >>> # Standard time
    >>> dt += timedelta(days=7)
    >>> print(dt)
    2020-11-07 12:00:00-08:00
    >>> print(dt.tzname())
    PST
    
    53 for this operation is updated. (Contributed by Dong-hee Na in bpo-39434.)

  • Giải mã các chuỗi ASCII ngắn với các codec UTF-8 và ASCII hiện nhanh hơn khoảng 15%. (Được đóng góp bởi Inada Naoki trong BPO-37348.)

Tại đây, một bản tóm tắt các cải tiến hiệu suất từ ​​Python 3,4 đến Python 3.9:

Python version                       3.4     3.5     3.6     3.7     3.8    3.9
--------------                       ---     ---     ---     ---     ---    ---

Variable and attribute read access:
    read_local                       7.1     7.1     5.4     5.1     3.9    3.9
    read_nonlocal                    7.1     8.1     5.8     5.4     4.4    4.5
    read_global                     15.5    19.0    14.3    13.6     7.6    7.8
    read_builtin                    21.1    21.6    18.5    19.0     7.5    7.8
    read_classvar_from_class        25.6    26.5    20.7    19.5    18.4   17.9
    read_classvar_from_instance     22.8    23.5    18.8    17.1    16.4   16.9
    read_instancevar                32.4    33.1    28.0    26.3    25.4   25.3
    read_instancevar_slots          27.8    31.3    20.8    20.8    20.2   20.5
    read_namedtuple                 73.8    57.5    45.0    46.8    18.4   18.7
    read_boundmethod                37.6    37.9    29.6    26.9    27.7   41.1

Variable and attribute write access:
    write_local                      8.7     9.3     5.5     5.3     4.3    4.3
    write_nonlocal                  10.5    11.1     5.6     5.5     4.7    4.8
    write_global                    19.7    21.2    18.0    18.0    15.8   16.7
    write_classvar                  92.9    96.0   104.6   102.1    39.2   39.8
    write_instancevar               44.6    45.8    40.0    38.9    35.5   37.4
    write_instancevar_slots         35.6    36.1    27.3    26.6    25.7   25.8

Data structure read access:
    read_list                       24.2    24.5    20.8    20.8    19.0   19.5
    read_deque                      24.7    25.5    20.2    20.6    19.8   20.2
    read_dict                       24.3    25.7    22.3    23.0    21.0   22.4
    read_strdict                    22.6    24.3    19.5    21.2    18.9   21.5

Data structure write access:
    write_list                      27.1    28.5    22.5    21.6    20.0   20.0
    write_deque                     28.7    30.1    22.7    21.8    23.5   21.7
    write_dict                      31.4    33.3    29.3    29.2    24.7   25.4
    write_strdict                   28.4    29.9    27.5    25.2    23.1   24.5

Stack (or queue) operations:
    list_append_pop                 93.4   112.7    75.4    74.2    50.8   50.6
    deque_append_pop                43.5    57.0    49.4    49.2    42.5   44.2
    deque_append_popleft            43.7    57.3    49.7    49.7    42.8   46.4

Timing loop:
    loop_overhead                    0.5     0.6     0.4     0.3     0.3    0.3

Những kết quả này được tạo ra từ tập lệnh điểm chuẩn truy cập thay đổi tại:

>>> from zoneinfo import ZoneInfo
>>> from datetime import datetime, timedelta

>>> # Daylight saving time
>>> dt = datetime(2020, 10, 31, 12, tzinfo=ZoneInfo("America/Los_Angeles"))
>>> print(dt)
2020-10-31 12:00:00-07:00
>>> dt.tzname()
'PDT'

>>> # Standard time
>>> dt += timedelta(days=7)
>>> print(dt)
2020-11-07 12:00:00-08:00
>>> print(dt.tzname())
PST
54. Kịch bản điểm chuẩn hiển thị thời gian tính bằng nano giây. Các điểm chuẩn được đo trên bộ xử lý Intel® Core ™ I7-4960HQ chạy các bản dựng MacOS 64 bit được tìm thấy tại Python.org.

Không mất giá

  • Lệnh Distutils

    >>> from zoneinfo import ZoneInfo
    >>> from datetime import datetime, timedelta
    
    >>> # Daylight saving time
    >>> dt = datetime(2020, 10, 31, 12, tzinfo=ZoneInfo("America/Los_Angeles"))
    >>> print(dt)
    2020-10-31 12:00:00-07:00
    >>> dt.tzname()
    'PDT'
    
    >>> # Standard time
    >>> dt += timedelta(days=7)
    >>> print(dt)
    2020-11-07 12:00:00-08:00
    >>> print(dt.tzname())
    PST
    
    55 hiện không được dùng, sử dụng
    >>> from zoneinfo import ZoneInfo
    >>> from datetime import datetime, timedelta
    
    >>> # Daylight saving time
    >>> dt = datetime(2020, 10, 31, 12, tzinfo=ZoneInfo("America/Los_Angeles"))
    >>> print(dt)
    2020-10-31 12:00:00-07:00
    >>> dt.tzname()
    'PDT'
    
    >>> # Standard time
    >>> dt += timedelta(days=7)
    >>> print(dt)
    2020-11-07 12:00:00-08:00
    >>> print(dt.tzname())
    PST
    
    56 (gói bánh xe) thay thế. (Được đóng góp bởi Hugo van Kemenade trong BPO-39586.)

  • Hiện tại

    >>> from zoneinfo import ZoneInfo
    >>> from datetime import datetime, timedelta
    
    >>> # Daylight saving time
    >>> dt = datetime(2020, 10, 31, 12, tzinfo=ZoneInfo("America/Los_Angeles"))
    >>> print(dt)
    2020-10-31 12:00:00-07:00
    >>> dt.tzname()
    'PDT'
    
    >>> # Standard time
    >>> dt += timedelta(days=7)
    >>> print(dt)
    2020-11-07 12:00:00-08:00
    >>> print(dt.tzname())
    PST
    
    57 chấp nhận các trường hợp
    >>> from zoneinfo import ZoneInfo
    >>> from datetime import datetime, timedelta
    
    >>> # Daylight saving time
    >>> dt = datetime(2020, 10, 31, 12, tzinfo=ZoneInfo("America/Los_Angeles"))
    >>> print(dt)
    2020-10-31 12:00:00-07:00
    >>> dt.tzname()
    'PDT'
    
    >>> # Standard time
    >>> dt += timedelta(days=7)
    >>> print(dt)
    2020-11-07 12:00:00-08:00
    >>> print(dt.tzname())
    PST
    
    58 với các giá trị số nguyên không âm (như
    >>> from zoneinfo import ZoneInfo
    >>> from datetime import datetime, timedelta
    
    >>> # Daylight saving time
    >>> dt = datetime(2020, 10, 31, 12, tzinfo=ZoneInfo("America/Los_Angeles"))
    >>> print(dt)
    2020-10-31 12:00:00-07:00
    >>> dt.tzname()
    'PDT'
    
    >>> # Standard time
    >>> dt += timedelta(days=7)
    >>> print(dt)
    2020-11-07 12:00:00-08:00
    >>> print(dt.tzname())
    PST
    
    59). Nó làm tăng
    >>> from typing import Literal
    >>> Literal[{0}]
    >>> Literal[{0}] == Literal[{False}]
    Traceback (most recent call last):
      File "", line 1, in 
    TypeError: unhashable type: 'set'
    
    2 cho phao không tích phân và âm âm. Nó bây giờ không được dùng. Trong các phiên bản Python trong tương lai, nó sẽ tăng os.pidfd_open()8 cho tất cả các phao. (Được đóng góp bởi Serhiy Storchaka trong BPO-37315.)

  • Các mô -đun

    #if PY_VERSION_HEX >= 0x03090000
        // This was not needed before Python 3.9 (bpo-35810 and bpo-40217)
        if (base->tp_flags & Py_TPFLAGS_HEAPTYPE) {
            // a heap type's tp_traverse already visited Py_TYPE(self)
        } else {
            Py_VISIT(Py_TYPE(self));
        }
    #else
    
    7 và
    >>> from zoneinfo import ZoneInfo
    >>> from datetime import datetime, timedelta
    
    >>> # Daylight saving time
    >>> dt = datetime(2020, 10, 31, 12, tzinfo=ZoneInfo("America/Los_Angeles"))
    >>> print(dt)
    2020-10-31 12:00:00-07:00
    >>> dt.tzname()
    'PDT'
    
    >>> # Standard time
    >>> dt += timedelta(days=7)
    >>> print(dt)
    2020-11-07 12:00:00-08:00
    >>> print(dt.tzname())
    PST
    
    63 được không dùng nữa và sẽ bị xóa trong các phiên bản Python trong tương lai. Đối với phần lớn các trường hợp sử dụng, người dùng có thể tận dụng giai đoạn tạo và biên dịch cây cú pháp trừu tượng (AST), sử dụng mô -đun
    >>> from zoneinfo import ZoneInfo
    >>> from datetime import datetime, timedelta
    
    >>> # Daylight saving time
    >>> dt = datetime(2020, 10, 31, 12, tzinfo=ZoneInfo("America/Los_Angeles"))
    >>> print(dt)
    2020-10-31 12:00:00-07:00
    >>> dt.tzname()
    'PDT'
    
    >>> # Standard time
    >>> dt += timedelta(days=7)
    >>> print(dt)
    2020-11-07 12:00:00-08:00
    >>> print(dt.tzname())
    PST
    
    5.

  • Các hàm A API công khai

    >>> from zoneinfo import ZoneInfo
    >>> from datetime import datetime, timedelta
    
    >>> # Daylight saving time
    >>> dt = datetime(2020, 10, 31, 12, tzinfo=ZoneInfo("America/Los_Angeles"))
    >>> print(dt)
    2020-10-31 12:00:00-07:00
    >>> dt.tzname()
    'PDT'
    
    >>> # Standard time
    >>> dt += timedelta(days=7)
    >>> print(dt)
    2020-11-07 12:00:00-08:00
    >>> print(dt.tzname())
    PST
    
    65,
    >>> from zoneinfo import ZoneInfo
    >>> from datetime import datetime, timedelta
    
    >>> # Daylight saving time
    >>> dt = datetime(2020, 10, 31, 12, tzinfo=ZoneInfo("America/Los_Angeles"))
    >>> print(dt)
    2020-10-31 12:00:00-07:00
    >>> dt.tzname()
    'PDT'
    
    >>> # Standard time
    >>> dt += timedelta(days=7)
    >>> print(dt)
    2020-11-07 12:00:00-08:00
    >>> print(dt.tzname())
    PST
    
    66,
    >>> from zoneinfo import ZoneInfo
    >>> from datetime import datetime, timedelta
    
    >>> # Daylight saving time
    >>> dt = datetime(2020, 10, 31, 12, tzinfo=ZoneInfo("America/Los_Angeles"))
    >>> print(dt)
    2020-10-31 12:00:00-07:00
    >>> dt.tzname()
    'PDT'
    
    >>> # Standard time
    >>> dt += timedelta(days=7)
    >>> print(dt)
    2020-11-07 12:00:00-08:00
    >>> print(dt.tzname())
    PST
    
    67 và
    >>> from zoneinfo import ZoneInfo
    >>> from datetime import datetime, timedelta
    
    >>> # Daylight saving time
    >>> dt = datetime(2020, 10, 31, 12, tzinfo=ZoneInfo("America/Los_Angeles"))
    >>> print(dt)
    2020-10-31 12:00:00-07:00
    >>> dt.tzname()
    'PDT'
    
    >>> # Standard time
    >>> dt += timedelta(days=7)
    >>> print(dt)
    2020-11-07 12:00:00-08:00
    >>> print(dt.tzname())
    PST
    
    68 không được chấp nhận và sẽ bị xóa trong Python 3.10 cùng với trình phân tích cú pháp cũ.

  • Sử dụng

    >>> from zoneinfo import ZoneInfo
    >>> from datetime import datetime, timedelta
    
    >>> # Daylight saving time
    >>> dt = datetime(2020, 10, 31, 12, tzinfo=ZoneInfo("America/Los_Angeles"))
    >>> print(dt)
    2020-10-31 12:00:00-07:00
    >>> dt.tzname()
    'PDT'
    
    >>> # Standard time
    >>> dt += timedelta(days=7)
    >>> print(dt)
    2020-11-07 12:00:00-08:00
    >>> print(dt.tzname())
    PST
    
    69 trong bối cảnh Boolean đã bị phản đối, vì nó hầu như chỉ là kết quả của việc triển khai bộ so sánh phong phú không chính xác. Nó sẽ được thực hiện một os.pidfd_open()8 trong một phiên bản Python trong tương lai. (Được đóng góp bởi Josh Rosenberg trong BPO-35712.)

  • Mô -đun

    Python version                       3.4     3.5     3.6     3.7     3.8    3.9
    --------------                       ---     ---     ---     ---     ---    ---
    
    Variable and attribute read access:
        read_local                       7.1     7.1     5.4     5.1     3.9    3.9
        read_nonlocal                    7.1     8.1     5.8     5.4     4.4    4.5
        read_global                     15.5    19.0    14.3    13.6     7.6    7.8
        read_builtin                    21.1    21.6    18.5    19.0     7.5    7.8
        read_classvar_from_class        25.6    26.5    20.7    19.5    18.4   17.9
        read_classvar_from_instance     22.8    23.5    18.8    17.1    16.4   16.9
        read_instancevar                32.4    33.1    28.0    26.3    25.4   25.3
        read_instancevar_slots          27.8    31.3    20.8    20.8    20.2   20.5
        read_namedtuple                 73.8    57.5    45.0    46.8    18.4   18.7
        read_boundmethod                37.6    37.9    29.6    26.9    27.7   41.1
    
    Variable and attribute write access:
        write_local                      8.7     9.3     5.5     5.3     4.3    4.3
        write_nonlocal                  10.5    11.1     5.6     5.5     4.7    4.8
        write_global                    19.7    21.2    18.0    18.0    15.8   16.7
        write_classvar                  92.9    96.0   104.6   102.1    39.2   39.8
        write_instancevar               44.6    45.8    40.0    38.9    35.5   37.4
        write_instancevar_slots         35.6    36.1    27.3    26.6    25.7   25.8
    
    Data structure read access:
        read_list                       24.2    24.5    20.8    20.8    19.0   19.5
        read_deque                      24.7    25.5    20.2    20.6    19.8   20.2
        read_dict                       24.3    25.7    22.3    23.0    21.0   22.4
        read_strdict                    22.6    24.3    19.5    21.2    18.9   21.5
    
    Data structure write access:
        write_list                      27.1    28.5    22.5    21.6    20.0   20.0
        write_deque                     28.7    30.1    22.7    21.8    23.5   21.7
        write_dict                      31.4    33.3    29.3    29.2    24.7   25.4
        write_strdict                   28.4    29.9    27.5    25.2    23.1   24.5
    
    Stack (or queue) operations:
        list_append_pop                 93.4   112.7    75.4    74.2    50.8   50.6
        deque_append_pop                43.5    57.0    49.4    49.2    42.5   44.2
        deque_append_popleft            43.7    57.3    49.7    49.7    42.8   46.4
    
    Timing loop:
        loop_overhead                    0.5     0.6     0.4     0.3     0.3    0.3
    
    0 hiện chấp nhận bất kỳ loại băm nào là giá trị hạt giống có thể. Thật không may, một số loại đó không được đảm bảo có giá trị băm xác định. Sau Python 3.9, mô -đun sẽ hạn chế hạt của nó ở
    >>> from zoneinfo import ZoneInfo
    >>> from datetime import datetime, timedelta
    
    >>> # Daylight saving time
    >>> dt = datetime(2020, 10, 31, 12, tzinfo=ZoneInfo("America/Los_Angeles"))
    >>> print(dt)
    2020-10-31 12:00:00-07:00
    >>> dt.tzname()
    'PDT'
    
    >>> # Standard time
    >>> dt += timedelta(days=7)
    >>> print(dt)
    2020-11-07 12:00:00-08:00
    >>> print(dt.tzname())
    PST
    
    72,
    >>> from zoneinfo import ZoneInfo
    >>> from datetime import datetime, timedelta
    
    >>> # Daylight saving time
    >>> dt = datetime(2020, 10, 31, 12, tzinfo=ZoneInfo("America/Los_Angeles"))
    >>> print(dt)
    2020-10-31 12:00:00-07:00
    >>> dt.tzname()
    'PDT'
    
    >>> # Standard time
    >>> dt += timedelta(days=7)
    >>> print(dt)
    2020-11-07 12:00:00-08:00
    >>> print(dt.tzname())
    PST
    
    73,
    >>> from zoneinfo import ZoneInfo
    >>> from datetime import datetime, timedelta
    
    >>> # Daylight saving time
    >>> dt = datetime(2020, 10, 31, 12, tzinfo=ZoneInfo("America/Los_Angeles"))
    >>> print(dt)
    2020-10-31 12:00:00-07:00
    >>> dt.tzname()
    'PDT'
    
    >>> # Standard time
    >>> dt += timedelta(days=7)
    >>> print(dt)
    2020-11-07 12:00:00-08:00
    >>> print(dt.tzname())
    PST
    
    58,
    >>> from zoneinfo import ZoneInfo
    >>> from datetime import datetime, timedelta
    
    >>> # Daylight saving time
    >>> dt = datetime(2020, 10, 31, 12, tzinfo=ZoneInfo("America/Los_Angeles"))
    >>> print(dt)
    2020-10-31 12:00:00-07:00
    >>> dt.tzname()
    'PDT'
    
    >>> # Standard time
    >>> dt += timedelta(days=7)
    >>> print(dt)
    2020-11-07 12:00:00-08:00
    >>> print(dt.tzname())
    PST
    
    75,
    base->tp_traverse(self, visit, arg)
    
    7 và
    base->tp_traverse(self, visit, arg)
    
    8.

  • Mở tệp

    >>> from zoneinfo import ZoneInfo
    >>> from datetime import datetime, timedelta
    
    >>> # Daylight saving time
    >>> dt = datetime(2020, 10, 31, 12, tzinfo=ZoneInfo("America/Los_Angeles"))
    >>> print(dt)
    2020-10-31 12:00:00-07:00
    >>> dt.tzname()
    'PDT'
    
    >>> # Standard time
    >>> dt += timedelta(days=7)
    >>> print(dt)
    2020-11-07 12:00:00-08:00
    >>> print(dt.tzname())
    PST
    
    78 để viết mà không chỉ định đối số chế độ bị phản đối. Trong các phiên bản Python trong tương lai, nó sẽ luôn được mở để đọc theo mặc định. Chỉ định đối số chế độ để mở nó để viết và im lặng một cảnh báo. (Được đóng góp bởi Serhiy Storchaka trong BPO-28286.)

  • Đã phản đối phương pháp

    >>> from zoneinfo import ZoneInfo
    >>> from datetime import datetime, timedelta
    
    >>> # Daylight saving time
    >>> dt = datetime(2020, 10, 31, 12, tzinfo=ZoneInfo("America/Los_Angeles"))
    >>> print(dt)
    2020-10-31 12:00:00-07:00
    >>> dt.tzname()
    'PDT'
    
    >>> # Standard time
    >>> dt += timedelta(days=7)
    >>> print(dt)
    2020-11-07 12:00:00-08:00
    >>> print(dt.tzname())
    PST
    
    79 của
    >>> from zoneinfo import ZoneInfo
    >>> from datetime import datetime, timedelta
    
    >>> # Daylight saving time
    >>> dt = datetime(2020, 10, 31, 12, tzinfo=ZoneInfo("America/Los_Angeles"))
    >>> print(dt)
    2020-10-31 12:00:00-07:00
    >>> dt.tzname()
    'PDT'
    
    >>> # Standard time
    >>> dt += timedelta(days=7)
    >>> print(dt)
    2020-11-07 12:00:00-08:00
    >>> print(dt.tzname())
    PST
    
    80 có lợi cho phương pháp
    >>> from zoneinfo import ZoneInfo
    >>> from datetime import datetime, timedelta
    
    >>> # Daylight saving time
    >>> dt = datetime(2020, 10, 31, 12, tzinfo=ZoneInfo("America/Los_Angeles"))
    >>> print(dt)
    2020-10-31 12:00:00-07:00
    >>> dt.tzname()
    'PDT'
    
    >>> # Standard time
    >>> dt += timedelta(days=7)
    >>> print(dt)
    2020-11-07 12:00:00-08:00
    >>> print(dt.tzname())
    PST
    
    81 có hành vi nhất quán và có thể dự đoán hơn. (Được đóng góp bởi Serhiy Storchaka trong BPO-38371.)

  • Việc truyền rõ ràng các đối tượng Coroutine đến

    >>> from zoneinfo import ZoneInfo
    >>> from datetime import datetime, timedelta
    
    >>> # Daylight saving time
    >>> dt = datetime(2020, 10, 31, 12, tzinfo=ZoneInfo("America/Los_Angeles"))
    >>> print(dt)
    2020-10-31 12:00:00-07:00
    >>> dt.tzname()
    'PDT'
    
    >>> # Standard time
    >>> dt += timedelta(days=7)
    >>> print(dt)
    2020-11-07 12:00:00-08:00
    >>> print(dt.tzname())
    PST
    
    82 đã bị mất giá và sẽ bị xóa trong phiên bản 3.11. (Được đóng góp bởi Yury Selivanov và Kyle Stanley trong BPO-34790.)

  • Các tiêu chuẩn của Binhex4 và HexBin4 hiện không bị phản đối. Mô -đun

    >>> from zoneinfo import ZoneInfo
    >>> from datetime import datetime, timedelta
    
    >>> # Daylight saving time
    >>> dt = datetime(2020, 10, 31, 12, tzinfo=ZoneInfo("America/Los_Angeles"))
    >>> print(dt)
    2020-10-31 12:00:00-07:00
    >>> dt.tzname()
    'PDT'
    
    >>> # Standard time
    >>> dt += timedelta(days=7)
    >>> print(dt)
    2020-11-07 12:00:00-08:00
    >>> print(dt.tzname())
    PST
    
    83 và các chức năng
    >>> from zoneinfo import ZoneInfo
    >>> from datetime import datetime, timedelta
    
    >>> # Daylight saving time
    >>> dt = datetime(2020, 10, 31, 12, tzinfo=ZoneInfo("America/Los_Angeles"))
    >>> print(dt)
    2020-10-31 12:00:00-07:00
    >>> dt.tzname()
    'PDT'
    
    >>> # Standard time
    >>> dt += timedelta(days=7)
    >>> print(dt)
    2020-11-07 12:00:00-08:00
    >>> print(dt.tzname())
    PST
    
    84 sau đây không được chấp nhận:

    • >>> from zoneinfo import ZoneInfo
      >>> from datetime import datetime, timedelta
      
      >>> # Daylight saving time
      >>> dt = datetime(2020, 10, 31, 12, tzinfo=ZoneInfo("America/Los_Angeles"))
      >>> print(dt)
      2020-10-31 12:00:00-07:00
      >>> dt.tzname()
      'PDT'
      
      >>> # Standard time
      >>> dt += timedelta(days=7)
      >>> print(dt)
      2020-11-07 12:00:00-08:00
      >>> print(dt.tzname())
      PST
      
      85,
      >>> from zoneinfo import ZoneInfo
      >>> from datetime import datetime, timedelta
      
      >>> # Daylight saving time
      >>> dt = datetime(2020, 10, 31, 12, tzinfo=ZoneInfo("America/Los_Angeles"))
      >>> print(dt)
      2020-10-31 12:00:00-07:00
      >>> dt.tzname()
      'PDT'
      
      >>> # Standard time
      >>> dt += timedelta(days=7)
      >>> print(dt)
      2020-11-07 12:00:00-08:00
      >>> print(dt.tzname())
      PST
      
      86

    • >>> from zoneinfo import ZoneInfo
      >>> from datetime import datetime, timedelta
      
      >>> # Daylight saving time
      >>> dt = datetime(2020, 10, 31, 12, tzinfo=ZoneInfo("America/Los_Angeles"))
      >>> print(dt)
      2020-10-31 12:00:00-07:00
      >>> dt.tzname()
      'PDT'
      
      >>> # Standard time
      >>> dt += timedelta(days=7)
      >>> print(dt)
      2020-11-07 12:00:00-08:00
      >>> print(dt.tzname())
      PST
      
      87,
      >>> from zoneinfo import ZoneInfo
      >>> from datetime import datetime, timedelta
      
      >>> # Daylight saving time
      >>> dt = datetime(2020, 10, 31, 12, tzinfo=ZoneInfo("America/Los_Angeles"))
      >>> print(dt)
      2020-10-31 12:00:00-07:00
      >>> dt.tzname()
      'PDT'
      
      >>> # Standard time
      >>> dt += timedelta(days=7)
      >>> print(dt)
      2020-11-07 12:00:00-08:00
      >>> print(dt.tzname())
      PST
      
      88

    (Được đóng góp bởi Victor Stinner trong BPO-39353.)

  • >>> from zoneinfo import ZoneInfo
    >>> from datetime import datetime, timedelta
    
    >>> # Daylight saving time
    >>> dt = datetime(2020, 10, 31, 12, tzinfo=ZoneInfo("America/Los_Angeles"))
    >>> print(dt)
    2020-10-31 12:00:00-07:00
    >>> dt.tzname()
    'PDT'
    
    >>> # Standard time
    >>> dt += timedelta(days=7)
    >>> print(dt)
    2020-11-07 12:00:00-08:00
    >>> print(dt.tzname())
    PST
    
    5 Các lớp
    >>> from zoneinfo import ZoneInfo
    >>> from datetime import datetime, timedelta
    
    >>> # Daylight saving time
    >>> dt = datetime(2020, 10, 31, 12, tzinfo=ZoneInfo("America/Los_Angeles"))
    >>> print(dt)
    2020-10-31 12:00:00-07:00
    >>> dt.tzname()
    'PDT'
    
    >>> # Standard time
    >>> dt += timedelta(days=7)
    >>> print(dt)
    2020-11-07 12:00:00-08:00
    >>> print(dt.tzname())
    PST
    
    90,
    >>> from zoneinfo import ZoneInfo
    >>> from datetime import datetime, timedelta
    
    >>> # Daylight saving time
    >>> dt = datetime(2020, 10, 31, 12, tzinfo=ZoneInfo("America/Los_Angeles"))
    >>> print(dt)
    2020-10-31 12:00:00-07:00
    >>> dt.tzname()
    'PDT'
    
    >>> # Standard time
    >>> dt += timedelta(days=7)
    >>> print(dt)
    2020-11-07 12:00:00-08:00
    >>> print(dt.tzname())
    PST
    
    91 và
    >>> from zoneinfo import ZoneInfo
    >>> from datetime import datetime, timedelta
    
    >>> # Daylight saving time
    >>> dt = datetime(2020, 10, 31, 12, tzinfo=ZoneInfo("America/Los_Angeles"))
    >>> print(dt)
    2020-10-31 12:00:00-07:00
    >>> dt.tzname()
    'PDT'
    
    >>> # Standard time
    >>> dt += timedelta(days=7)
    >>> print(dt)
    2020-11-07 12:00:00-08:00
    >>> print(dt.tzname())
    PST
    
    92 được coi là không dùng nữa và sẽ được xóa trong các phiên bản Python trong tương lai.
    >>> from zoneinfo import ZoneInfo
    >>> from datetime import datetime, timedelta
    
    >>> # Daylight saving time
    >>> dt = datetime(2020, 10, 31, 12, tzinfo=ZoneInfo("America/Los_Angeles"))
    >>> print(dt)
    2020-10-31 12:00:00-07:00
    >>> dt.tzname()
    'PDT'
    
    >>> # Standard time
    >>> dt += timedelta(days=7)
    >>> print(dt)
    2020-11-07 12:00:00-08:00
    >>> print(dt.tzname())
    PST
    
    93 nên sử dụng thay vì
    >>> from zoneinfo import ZoneInfo
    >>> from datetime import datetime, timedelta
    
    >>> # Daylight saving time
    >>> dt = datetime(2020, 10, 31, 12, tzinfo=ZoneInfo("America/Los_Angeles"))
    >>> print(dt)
    2020-10-31 12:00:00-07:00
    >>> dt.tzname()
    'PDT'
    
    >>> # Standard time
    >>> dt += timedelta(days=7)
    >>> print(dt)
    2020-11-07 12:00:00-08:00
    >>> print(dt.tzname())
    PST
    
    94.
    >>> from zoneinfo import ZoneInfo
    >>> from datetime import datetime, timedelta
    
    >>> # Daylight saving time
    >>> dt = datetime(2020, 10, 31, 12, tzinfo=ZoneInfo("America/Los_Angeles"))
    >>> print(dt)
    2020-10-31 12:00:00-07:00
    >>> dt.tzname()
    'PDT'
    
    >>> # Standard time
    >>> dt += timedelta(days=7)
    >>> print(dt)
    2020-11-07 12:00:00-08:00
    >>> print(dt.tzname())
    PST
    
    95 nên được sử dụng thay vì
    >>> from zoneinfo import ZoneInfo
    >>> from datetime import datetime, timedelta
    
    >>> # Daylight saving time
    >>> dt = datetime(2020, 10, 31, 12, tzinfo=ZoneInfo("America/Los_Angeles"))
    >>> print(dt)
    2020-10-31 12:00:00-07:00
    >>> dt.tzname()
    'PDT'
    
    >>> # Standard time
    >>> dt += timedelta(days=7)
    >>> print(dt)
    2020-11-07 12:00:00-08:00
    >>> print(dt.tzname())
    PST
    
    96. (Được đóng góp bởi Serhiy Storchaka trong BPO-34822.)

  • >>> from zoneinfo import ZoneInfo
    >>> from datetime import datetime, timedelta
    
    >>> # Daylight saving time
    >>> dt = datetime(2020, 10, 31, 12, tzinfo=ZoneInfo("America/Los_Angeles"))
    >>> print(dt)
    2020-10-31 12:00:00-07:00
    >>> dt.tzname()
    'PDT'
    
    >>> # Standard time
    >>> dt += timedelta(days=7)
    >>> print(dt)
    2020-11-07 12:00:00-08:00
    >>> print(dt.tzname())
    PST
    
    5 Các lớp
    >>> from zoneinfo import ZoneInfo
    >>> from datetime import datetime, timedelta
    
    >>> # Daylight saving time
    >>> dt = datetime(2020, 10, 31, 12, tzinfo=ZoneInfo("America/Los_Angeles"))
    >>> print(dt)
    2020-10-31 12:00:00-07:00
    >>> dt.tzname()
    'PDT'
    
    >>> # Standard time
    >>> dt += timedelta(days=7)
    >>> print(dt)
    2020-11-07 12:00:00-08:00
    >>> print(dt.tzname())
    PST
    
    98,
    >>> from zoneinfo import ZoneInfo
    >>> from datetime import datetime, timedelta
    
    >>> # Daylight saving time
    >>> dt = datetime(2020, 10, 31, 12, tzinfo=ZoneInfo("America/Los_Angeles"))
    >>> print(dt)
    2020-10-31 12:00:00-07:00
    >>> dt.tzname()
    'PDT'
    
    >>> # Standard time
    >>> dt += timedelta(days=7)
    >>> print(dt)
    2020-11-07 12:00:00-08:00
    >>> print(dt.tzname())
    PST
    
    99,
    Python version                       3.4     3.5     3.6     3.7     3.8    3.9
    --------------                       ---     ---     ---     ---     ---    ---
    
    Variable and attribute read access:
        read_local                       7.1     7.1     5.4     5.1     3.9    3.9
        read_nonlocal                    7.1     8.1     5.8     5.4     4.4    4.5
        read_global                     15.5    19.0    14.3    13.6     7.6    7.8
        read_builtin                    21.1    21.6    18.5    19.0     7.5    7.8
        read_classvar_from_class        25.6    26.5    20.7    19.5    18.4   17.9
        read_classvar_from_instance     22.8    23.5    18.8    17.1    16.4   16.9
        read_instancevar                32.4    33.1    28.0    26.3    25.4   25.3
        read_instancevar_slots          27.8    31.3    20.8    20.8    20.2   20.5
        read_namedtuple                 73.8    57.5    45.0    46.8    18.4   18.7
        read_boundmethod                37.6    37.9    29.6    26.9    27.7   41.1
    
    Variable and attribute write access:
        write_local                      8.7     9.3     5.5     5.3     4.3    4.3
        write_nonlocal                  10.5    11.1     5.6     5.5     4.7    4.8
        write_global                    19.7    21.2    18.0    18.0    15.8   16.7
        write_classvar                  92.9    96.0   104.6   102.1    39.2   39.8
        write_instancevar               44.6    45.8    40.0    38.9    35.5   37.4
        write_instancevar_slots         35.6    36.1    27.3    26.6    25.7   25.8
    
    Data structure read access:
        read_list                       24.2    24.5    20.8    20.8    19.0   19.5
        read_deque                      24.7    25.5    20.2    20.6    19.8   20.2
        read_dict                       24.3    25.7    22.3    23.0    21.0   22.4
        read_strdict                    22.6    24.3    19.5    21.2    18.9   21.5
    
    Data structure write access:
        write_list                      27.1    28.5    22.5    21.6    20.0   20.0
        write_deque                     28.7    30.1    22.7    21.8    23.5   21.7
        write_dict                      31.4    33.3    29.3    29.2    24.7   25.4
        write_strdict                   28.4    29.9    27.5    25.2    23.1   24.5
    
    Stack (or queue) operations:
        list_append_pop                 93.4   112.7    75.4    74.2    50.8   50.6
        deque_append_pop                43.5    57.0    49.4    49.2    42.5   44.2
        deque_append_popleft            43.7    57.3    49.7    49.7    42.8   46.4
    
    Timing loop:
        loop_overhead                    0.5     0.6     0.4     0.3     0.3    0.3
    
    00 và
    Python version                       3.4     3.5     3.6     3.7     3.8    3.9
    --------------                       ---     ---     ---     ---     ---    ---
    
    Variable and attribute read access:
        read_local                       7.1     7.1     5.4     5.1     3.9    3.9
        read_nonlocal                    7.1     8.1     5.8     5.4     4.4    4.5
        read_global                     15.5    19.0    14.3    13.6     7.6    7.8
        read_builtin                    21.1    21.6    18.5    19.0     7.5    7.8
        read_classvar_from_class        25.6    26.5    20.7    19.5    18.4   17.9
        read_classvar_from_instance     22.8    23.5    18.8    17.1    16.4   16.9
        read_instancevar                32.4    33.1    28.0    26.3    25.4   25.3
        read_instancevar_slots          27.8    31.3    20.8    20.8    20.2   20.5
        read_namedtuple                 73.8    57.5    45.0    46.8    18.4   18.7
        read_boundmethod                37.6    37.9    29.6    26.9    27.7   41.1
    
    Variable and attribute write access:
        write_local                      8.7     9.3     5.5     5.3     4.3    4.3
        write_nonlocal                  10.5    11.1     5.6     5.5     4.7    4.8
        write_global                    19.7    21.2    18.0    18.0    15.8   16.7
        write_classvar                  92.9    96.0   104.6   102.1    39.2   39.8
        write_instancevar               44.6    45.8    40.0    38.9    35.5   37.4
        write_instancevar_slots         35.6    36.1    27.3    26.6    25.7   25.8
    
    Data structure read access:
        read_list                       24.2    24.5    20.8    20.8    19.0   19.5
        read_deque                      24.7    25.5    20.2    20.6    19.8   20.2
        read_dict                       24.3    25.7    22.3    23.0    21.0   22.4
        read_strdict                    22.6    24.3    19.5    21.2    18.9   21.5
    
    Data structure write access:
        write_list                      27.1    28.5    22.5    21.6    20.0   20.0
        write_deque                     28.7    30.1    22.7    21.8    23.5   21.7
        write_dict                      31.4    33.3    29.3    29.2    24.7   25.4
        write_strdict                   28.4    29.9    27.5    25.2    23.1   24.5
    
    Stack (or queue) operations:
        list_append_pop                 93.4   112.7    75.4    74.2    50.8   50.6
        deque_append_pop                43.5    57.0    49.4    49.2    42.5   44.2
        deque_append_popleft            43.7    57.3    49.7    49.7    42.8   46.4
    
    Timing loop:
        loop_overhead                    0.5     0.6     0.4     0.3     0.3    0.3
    
    01 được coi là không dùng nữa và sẽ bị xóa trong các phiên bản Python trong tương lai. Chúng không được tạo bởi trình phân tích cú pháp và không được trình tạo mã trong Python 3. (được đóng góp bởi Batuhan Taskaya trong BPO-39639 và BPO-39969 và Serhiy Storchaka trong BPO-39988.)

  • Các chức năng

    Python version                       3.4     3.5     3.6     3.7     3.8    3.9
    --------------                       ---     ---     ---     ---     ---    ---
    
    Variable and attribute read access:
        read_local                       7.1     7.1     5.4     5.1     3.9    3.9
        read_nonlocal                    7.1     8.1     5.8     5.4     4.4    4.5
        read_global                     15.5    19.0    14.3    13.6     7.6    7.8
        read_builtin                    21.1    21.6    18.5    19.0     7.5    7.8
        read_classvar_from_class        25.6    26.5    20.7    19.5    18.4   17.9
        read_classvar_from_instance     22.8    23.5    18.8    17.1    16.4   16.9
        read_instancevar                32.4    33.1    28.0    26.3    25.4   25.3
        read_instancevar_slots          27.8    31.3    20.8    20.8    20.2   20.5
        read_namedtuple                 73.8    57.5    45.0    46.8    18.4   18.7
        read_boundmethod                37.6    37.9    29.6    26.9    27.7   41.1
    
    Variable and attribute write access:
        write_local                      8.7     9.3     5.5     5.3     4.3    4.3
        write_nonlocal                  10.5    11.1     5.6     5.5     4.7    4.8
        write_global                    19.7    21.2    18.0    18.0    15.8   16.7
        write_classvar                  92.9    96.0   104.6   102.1    39.2   39.8
        write_instancevar               44.6    45.8    40.0    38.9    35.5   37.4
        write_instancevar_slots         35.6    36.1    27.3    26.6    25.7   25.8
    
    Data structure read access:
        read_list                       24.2    24.5    20.8    20.8    19.0   19.5
        read_deque                      24.7    25.5    20.2    20.6    19.8   20.2
        read_dict                       24.3    25.7    22.3    23.0    21.0   22.4
        read_strdict                    22.6    24.3    19.5    21.2    18.9   21.5
    
    Data structure write access:
        write_list                      27.1    28.5    22.5    21.6    20.0   20.0
        write_deque                     28.7    30.1    22.7    21.8    23.5   21.7
        write_dict                      31.4    33.3    29.3    29.2    24.7   25.4
        write_strdict                   28.4    29.9    27.5    25.2    23.1   24.5
    
    Stack (or queue) operations:
        list_append_pop                 93.4   112.7    75.4    74.2    50.8   50.6
        deque_append_pop                43.5    57.0    49.4    49.2    42.5   44.2
        deque_append_popleft            43.7    57.3    49.7    49.7    42.8   46.4
    
    Timing loop:
        loop_overhead                    0.5     0.6     0.4     0.3     0.3    0.3
    
    02 và
    Python version                       3.4     3.5     3.6     3.7     3.8    3.9
    --------------                       ---     ---     ---     ---     ---    ---
    
    Variable and attribute read access:
        read_local                       7.1     7.1     5.4     5.1     3.9    3.9
        read_nonlocal                    7.1     8.1     5.8     5.4     4.4    4.5
        read_global                     15.5    19.0    14.3    13.6     7.6    7.8
        read_builtin                    21.1    21.6    18.5    19.0     7.5    7.8
        read_classvar_from_class        25.6    26.5    20.7    19.5    18.4   17.9
        read_classvar_from_instance     22.8    23.5    18.8    17.1    16.4   16.9
        read_instancevar                32.4    33.1    28.0    26.3    25.4   25.3
        read_instancevar_slots          27.8    31.3    20.8    20.8    20.2   20.5
        read_namedtuple                 73.8    57.5    45.0    46.8    18.4   18.7
        read_boundmethod                37.6    37.9    29.6    26.9    27.7   41.1
    
    Variable and attribute write access:
        write_local                      8.7     9.3     5.5     5.3     4.3    4.3
        write_nonlocal                  10.5    11.1     5.6     5.5     4.7    4.8
        write_global                    19.7    21.2    18.0    18.0    15.8   16.7
        write_classvar                  92.9    96.0   104.6   102.1    39.2   39.8
        write_instancevar               44.6    45.8    40.0    38.9    35.5   37.4
        write_instancevar_slots         35.6    36.1    27.3    26.6    25.7   25.8
    
    Data structure read access:
        read_list                       24.2    24.5    20.8    20.8    19.0   19.5
        read_deque                      24.7    25.5    20.2    20.6    19.8   20.2
        read_dict                       24.3    25.7    22.3    23.0    21.0   22.4
        read_strdict                    22.6    24.3    19.5    21.2    18.9   21.5
    
    Data structure write access:
        write_list                      27.1    28.5    22.5    21.6    20.0   20.0
        write_deque                     28.7    30.1    22.7    21.8    23.5   21.7
        write_dict                      31.4    33.3    29.3    29.2    24.7   25.4
        write_strdict                   28.4    29.9    27.5    25.2    23.1   24.5
    
    Stack (or queue) operations:
        list_append_pop                 93.4   112.7    75.4    74.2    50.8   50.6
        deque_append_pop                43.5    57.0    49.4    49.2    42.5   44.2
        deque_append_popleft            43.7    57.3    49.7    49.7    42.8   46.4
    
    Timing loop:
        loop_overhead                    0.5     0.6     0.4     0.3     0.3    0.3
    
    03 hiện không được chấp nhận và sẽ bị xóa trong Python 3.11. Gọi
    Python version                       3.4     3.5     3.6     3.7     3.8    3.9
    --------------                       ---     ---     ---     ---     ---    ---
    
    Variable and attribute read access:
        read_local                       7.1     7.1     5.4     5.1     3.9    3.9
        read_nonlocal                    7.1     8.1     5.8     5.4     4.4    4.5
        read_global                     15.5    19.0    14.3    13.6     7.6    7.8
        read_builtin                    21.1    21.6    18.5    19.0     7.5    7.8
        read_classvar_from_class        25.6    26.5    20.7    19.5    18.4   17.9
        read_classvar_from_instance     22.8    23.5    18.8    17.1    16.4   16.9
        read_instancevar                32.4    33.1    28.0    26.3    25.4   25.3
        read_instancevar_slots          27.8    31.3    20.8    20.8    20.2   20.5
        read_namedtuple                 73.8    57.5    45.0    46.8    18.4   18.7
        read_boundmethod                37.6    37.9    29.6    26.9    27.7   41.1
    
    Variable and attribute write access:
        write_local                      8.7     9.3     5.5     5.3     4.3    4.3
        write_nonlocal                  10.5    11.1     5.6     5.5     4.7    4.8
        write_global                    19.7    21.2    18.0    18.0    15.8   16.7
        write_classvar                  92.9    96.0   104.6   102.1    39.2   39.8
        write_instancevar               44.6    45.8    40.0    38.9    35.5   37.4
        write_instancevar_slots         35.6    36.1    27.3    26.6    25.7   25.8
    
    Data structure read access:
        read_list                       24.2    24.5    20.8    20.8    19.0   19.5
        read_deque                      24.7    25.5    20.2    20.6    19.8   20.2
        read_dict                       24.3    25.7    22.3    23.0    21.0   22.4
        read_strdict                    22.6    24.3    19.5    21.2    18.9   21.5
    
    Data structure write access:
        write_list                      27.1    28.5    22.5    21.6    20.0   20.0
        write_deque                     28.7    30.1    22.7    21.8    23.5   21.7
        write_dict                      31.4    33.3    29.3    29.2    24.7   25.4
        write_strdict                   28.4    29.9    27.5    25.2    23.1   24.5
    
    Stack (or queue) operations:
        list_append_pop                 93.4   112.7    75.4    74.2    50.8   50.6
        deque_append_pop                43.5    57.0    49.4    49.2    42.5   44.2
        deque_append_popleft            43.7    57.3    49.7    49.7    42.8   46.4
    
    Timing loop:
        loop_overhead                    0.5     0.6     0.4     0.3     0.3    0.3
    
    02 bây giờ không làm gì cả. GIL được khởi tạo bởi
    Python version                       3.4     3.5     3.6     3.7     3.8    3.9
    --------------                       ---     ---     ---     ---     ---    ---
    
    Variable and attribute read access:
        read_local                       7.1     7.1     5.4     5.1     3.9    3.9
        read_nonlocal                    7.1     8.1     5.8     5.4     4.4    4.5
        read_global                     15.5    19.0    14.3    13.6     7.6    7.8
        read_builtin                    21.1    21.6    18.5    19.0     7.5    7.8
        read_classvar_from_class        25.6    26.5    20.7    19.5    18.4   17.9
        read_classvar_from_instance     22.8    23.5    18.8    17.1    16.4   16.9
        read_instancevar                32.4    33.1    28.0    26.3    25.4   25.3
        read_instancevar_slots          27.8    31.3    20.8    20.8    20.2   20.5
        read_namedtuple                 73.8    57.5    45.0    46.8    18.4   18.7
        read_boundmethod                37.6    37.9    29.6    26.9    27.7   41.1
    
    Variable and attribute write access:
        write_local                      8.7     9.3     5.5     5.3     4.3    4.3
        write_nonlocal                  10.5    11.1     5.6     5.5     4.7    4.8
        write_global                    19.7    21.2    18.0    18.0    15.8   16.7
        write_classvar                  92.9    96.0   104.6   102.1    39.2   39.8
        write_instancevar               44.6    45.8    40.0    38.9    35.5   37.4
        write_instancevar_slots         35.6    36.1    27.3    26.6    25.7   25.8
    
    Data structure read access:
        read_list                       24.2    24.5    20.8    20.8    19.0   19.5
        read_deque                      24.7    25.5    20.2    20.6    19.8   20.2
        read_dict                       24.3    25.7    22.3    23.0    21.0   22.4
        read_strdict                    22.6    24.3    19.5    21.2    18.9   21.5
    
    Data structure write access:
        write_list                      27.1    28.5    22.5    21.6    20.0   20.0
        write_deque                     28.7    30.1    22.7    21.8    23.5   21.7
        write_dict                      31.4    33.3    29.3    29.2    24.7   25.4
        write_strdict                   28.4    29.9    27.5    25.2    23.1   24.5
    
    Stack (or queue) operations:
        list_append_pop                 93.4   112.7    75.4    74.2    50.8   50.6
        deque_append_pop                43.5    57.0    49.4    49.2    42.5   44.2
        deque_append_popleft            43.7    57.3    49.7    49.7    42.8   46.4
    
    Timing loop:
        loop_overhead                    0.5     0.6     0.4     0.3     0.3    0.3
    
    05 kể từ Python 3.7. (Được đóng góp bởi Victor Stinner trong BPO-39877.)GIL is initialized by
    Python version                       3.4     3.5     3.6     3.7     3.8    3.9
    --------------                       ---     ---     ---     ---     ---    ---
    
    Variable and attribute read access:
        read_local                       7.1     7.1     5.4     5.1     3.9    3.9
        read_nonlocal                    7.1     8.1     5.8     5.4     4.4    4.5
        read_global                     15.5    19.0    14.3    13.6     7.6    7.8
        read_builtin                    21.1    21.6    18.5    19.0     7.5    7.8
        read_classvar_from_class        25.6    26.5    20.7    19.5    18.4   17.9
        read_classvar_from_instance     22.8    23.5    18.8    17.1    16.4   16.9
        read_instancevar                32.4    33.1    28.0    26.3    25.4   25.3
        read_instancevar_slots          27.8    31.3    20.8    20.8    20.2   20.5
        read_namedtuple                 73.8    57.5    45.0    46.8    18.4   18.7
        read_boundmethod                37.6    37.9    29.6    26.9    27.7   41.1
    
    Variable and attribute write access:
        write_local                      8.7     9.3     5.5     5.3     4.3    4.3
        write_nonlocal                  10.5    11.1     5.6     5.5     4.7    4.8
        write_global                    19.7    21.2    18.0    18.0    15.8   16.7
        write_classvar                  92.9    96.0   104.6   102.1    39.2   39.8
        write_instancevar               44.6    45.8    40.0    38.9    35.5   37.4
        write_instancevar_slots         35.6    36.1    27.3    26.6    25.7   25.8
    
    Data structure read access:
        read_list                       24.2    24.5    20.8    20.8    19.0   19.5
        read_deque                      24.7    25.5    20.2    20.6    19.8   20.2
        read_dict                       24.3    25.7    22.3    23.0    21.0   22.4
        read_strdict                    22.6    24.3    19.5    21.2    18.9   21.5
    
    Data structure write access:
        write_list                      27.1    28.5    22.5    21.6    20.0   20.0
        write_deque                     28.7    30.1    22.7    21.8    23.5   21.7
        write_dict                      31.4    33.3    29.3    29.2    24.7   25.4
        write_strdict                   28.4    29.9    27.5    25.2    23.1   24.5
    
    Stack (or queue) operations:
        list_append_pop                 93.4   112.7    75.4    74.2    50.8   50.6
        deque_append_pop                43.5    57.0    49.4    49.2    42.5   44.2
        deque_append_popleft            43.7    57.3    49.7    49.7    42.8   46.4
    
    Timing loop:
        loop_overhead                    0.5     0.6     0.4     0.3     0.3    0.3
    
    05 since Python 3.7. (Contributed by Victor Stinner in bpo-39877.)

  • Vượt qua

    >>> from zoneinfo import ZoneInfo
    >>> from datetime import datetime, timedelta
    
    >>> # Daylight saving time
    >>> dt = datetime(2020, 10, 31, 12, tzinfo=ZoneInfo("America/Los_Angeles"))
    >>> print(dt)
    2020-10-31 12:00:00-07:00
    >>> dt.tzname()
    'PDT'
    
    >>> # Standard time
    >>> dt += timedelta(days=7)
    >>> print(dt)
    2020-11-07 12:00:00-08:00
    >>> print(dt.tzname())
    PST
    
    72 như là đối số đầu tiên cho hàm
    Python version                       3.4     3.5     3.6     3.7     3.8    3.9
    --------------                       ---     ---     ---     ---     ---    ---
    
    Variable and attribute read access:
        read_local                       7.1     7.1     5.4     5.1     3.9    3.9
        read_nonlocal                    7.1     8.1     5.8     5.4     4.4    4.5
        read_global                     15.5    19.0    14.3    13.6     7.6    7.8
        read_builtin                    21.1    21.6    18.5    19.0     7.5    7.8
        read_classvar_from_class        25.6    26.5    20.7    19.5    18.4   17.9
        read_classvar_from_instance     22.8    23.5    18.8    17.1    16.4   16.9
        read_instancevar                32.4    33.1    28.0    26.3    25.4   25.3
        read_instancevar_slots          27.8    31.3    20.8    20.8    20.2   20.5
        read_namedtuple                 73.8    57.5    45.0    46.8    18.4   18.7
        read_boundmethod                37.6    37.9    29.6    26.9    27.7   41.1
    
    Variable and attribute write access:
        write_local                      8.7     9.3     5.5     5.3     4.3    4.3
        write_nonlocal                  10.5    11.1     5.6     5.5     4.7    4.8
        write_global                    19.7    21.2    18.0    18.0    15.8   16.7
        write_classvar                  92.9    96.0   104.6   102.1    39.2   39.8
        write_instancevar               44.6    45.8    40.0    38.9    35.5   37.4
        write_instancevar_slots         35.6    36.1    27.3    26.6    25.7   25.8
    
    Data structure read access:
        read_list                       24.2    24.5    20.8    20.8    19.0   19.5
        read_deque                      24.7    25.5    20.2    20.6    19.8   20.2
        read_dict                       24.3    25.7    22.3    23.0    21.0   22.4
        read_strdict                    22.6    24.3    19.5    21.2    18.9   21.5
    
    Data structure write access:
        write_list                      27.1    28.5    22.5    21.6    20.0   20.0
        write_deque                     28.7    30.1    22.7    21.8    23.5   21.7
        write_dict                      31.4    33.3    29.3    29.2    24.7   25.4
        write_strdict                   28.4    29.9    27.5    25.2    23.1   24.5
    
    Stack (or queue) operations:
        list_append_pop                 93.4   112.7    75.4    74.2    50.8   50.6
        deque_append_pop                43.5    57.0    49.4    49.2    42.5   44.2
        deque_append_popleft            43.7    57.3    49.7    49.7    42.8   46.4
    
    Timing loop:
        loop_overhead                    0.5     0.6     0.4     0.3     0.3    0.3
    
    07 đã bị phản đối. (Được đóng góp bởi Zackery Spytz trong BPO-33262.)

  • Python version                       3.4     3.5     3.6     3.7     3.8    3.9
    --------------                       ---     ---     ---     ---     ---    ---
    
    Variable and attribute read access:
        read_local                       7.1     7.1     5.4     5.1     3.9    3.9
        read_nonlocal                    7.1     8.1     5.8     5.4     4.4    4.5
        read_global                     15.5    19.0    14.3    13.6     7.6    7.8
        read_builtin                    21.1    21.6    18.5    19.0     7.5    7.8
        read_classvar_from_class        25.6    26.5    20.7    19.5    18.4   17.9
        read_classvar_from_instance     22.8    23.5    18.8    17.1    16.4   16.9
        read_instancevar                32.4    33.1    28.0    26.3    25.4   25.3
        read_instancevar_slots          27.8    31.3    20.8    20.8    20.2   20.5
        read_namedtuple                 73.8    57.5    45.0    46.8    18.4   18.7
        read_boundmethod                37.6    37.9    29.6    26.9    27.7   41.1
    
    Variable and attribute write access:
        write_local                      8.7     9.3     5.5     5.3     4.3    4.3
        write_nonlocal                  10.5    11.1     5.6     5.5     4.7    4.8
        write_global                    19.7    21.2    18.0    18.0    15.8   16.7
        write_classvar                  92.9    96.0   104.6   102.1    39.2   39.8
        write_instancevar               44.6    45.8    40.0    38.9    35.5   37.4
        write_instancevar_slots         35.6    36.1    27.3    26.6    25.7   25.8
    
    Data structure read access:
        read_list                       24.2    24.5    20.8    20.8    19.0   19.5
        read_deque                      24.7    25.5    20.2    20.6    19.8   20.2
        read_dict                       24.3    25.7    22.3    23.0    21.0   22.4
        read_strdict                    22.6    24.3    19.5    21.2    18.9   21.5
    
    Data structure write access:
        write_list                      27.1    28.5    22.5    21.6    20.0   20.0
        write_deque                     28.7    30.1    22.7    21.8    23.5   21.7
        write_dict                      31.4    33.3    29.3    29.2    24.7   25.4
        write_strdict                   28.4    29.9    27.5    25.2    23.1   24.5
    
    Stack (or queue) operations:
        list_append_pop                 93.4   112.7    75.4    74.2    50.8   50.6
        deque_append_pop                43.5    57.0    49.4    49.2    42.5   44.2
        deque_append_popleft            43.7    57.3    49.7    49.7    42.8   46.4
    
    Timing loop:
        loop_overhead                    0.5     0.6     0.4     0.3     0.3    0.3
    
    08 hiện không bị phản đối vì không thể sử dụng được nếu không có mô -đun bên ngoài,
    Python version                       3.4     3.5     3.6     3.7     3.8    3.9
    --------------                       ---     ---     ---     ---     ---    ---
    
    Variable and attribute read access:
        read_local                       7.1     7.1     5.4     5.1     3.9    3.9
        read_nonlocal                    7.1     8.1     5.8     5.4     4.4    4.5
        read_global                     15.5    19.0    14.3    13.6     7.6    7.8
        read_builtin                    21.1    21.6    18.5    19.0     7.5    7.8
        read_classvar_from_class        25.6    26.5    20.7    19.5    18.4   17.9
        read_classvar_from_instance     22.8    23.5    18.8    17.1    16.4   16.9
        read_instancevar                32.4    33.1    28.0    26.3    25.4   25.3
        read_instancevar_slots          27.8    31.3    20.8    20.8    20.2   20.5
        read_namedtuple                 73.8    57.5    45.0    46.8    18.4   18.7
        read_boundmethod                37.6    37.9    29.6    26.9    27.7   41.1
    
    Variable and attribute write access:
        write_local                      8.7     9.3     5.5     5.3     4.3    4.3
        write_nonlocal                  10.5    11.1     5.6     5.5     4.7    4.8
        write_global                    19.7    21.2    18.0    18.0    15.8   16.7
        write_classvar                  92.9    96.0   104.6   102.1    39.2   39.8
        write_instancevar               44.6    45.8    40.0    38.9    35.5   37.4
        write_instancevar_slots         35.6    36.1    27.3    26.6    25.7   25.8
    
    Data structure read access:
        read_list                       24.2    24.5    20.8    20.8    19.0   19.5
        read_deque                      24.7    25.5    20.2    20.6    19.8   20.2
        read_dict                       24.3    25.7    22.3    23.0    21.0   22.4
        read_strdict                    22.6    24.3    19.5    21.2    18.9   21.5
    
    Data structure write access:
        write_list                      27.1    28.5    22.5    21.6    20.0   20.0
        write_deque                     28.7    30.1    22.7    21.8    23.5   21.7
        write_dict                      31.4    33.3    29.3    29.2    24.7   25.4
        write_strdict                   28.4    29.9    27.5    25.2    23.1   24.5
    
    Stack (or queue) operations:
        list_append_pop                 93.4   112.7    75.4    74.2    50.8   50.6
        deque_append_pop                43.5    57.0    49.4    49.2    42.5   44.2
        deque_append_popleft            43.7    57.3    49.7    49.7    42.8   46.4
    
    Timing loop:
        loop_overhead                    0.5     0.6     0.4     0.3     0.3    0.3
    
    09. (Được đóng góp bởi Samuel Colvin trong BPO-35800.)

  • Mô -đun

    Python version                       3.4     3.5     3.6     3.7     3.8    3.9
    --------------                       ---     ---     ---     ---     ---    ---
    
    Variable and attribute read access:
        read_local                       7.1     7.1     5.4     5.1     3.9    3.9
        read_nonlocal                    7.1     8.1     5.8     5.4     4.4    4.5
        read_global                     15.5    19.0    14.3    13.6     7.6    7.8
        read_builtin                    21.1    21.6    18.5    19.0     7.5    7.8
        read_classvar_from_class        25.6    26.5    20.7    19.5    18.4   17.9
        read_classvar_from_instance     22.8    23.5    18.8    17.1    16.4   16.9
        read_instancevar                32.4    33.1    28.0    26.3    25.4   25.3
        read_instancevar_slots          27.8    31.3    20.8    20.8    20.2   20.5
        read_namedtuple                 73.8    57.5    45.0    46.8    18.4   18.7
        read_boundmethod                37.6    37.9    29.6    26.9    27.7   41.1
    
    Variable and attribute write access:
        write_local                      8.7     9.3     5.5     5.3     4.3    4.3
        write_nonlocal                  10.5    11.1     5.6     5.5     4.7    4.8
        write_global                    19.7    21.2    18.0    18.0    15.8   16.7
        write_classvar                  92.9    96.0   104.6   102.1    39.2   39.8
        write_instancevar               44.6    45.8    40.0    38.9    35.5   37.4
        write_instancevar_slots         35.6    36.1    27.3    26.6    25.7   25.8
    
    Data structure read access:
        read_list                       24.2    24.5    20.8    20.8    19.0   19.5
        read_deque                      24.7    25.5    20.2    20.6    19.8   20.2
        read_dict                       24.3    25.7    22.3    23.0    21.0   22.4
        read_strdict                    22.6    24.3    19.5    21.2    18.9   21.5
    
    Data structure write access:
        write_list                      27.1    28.5    22.5    21.6    20.0   20.0
        write_deque                     28.7    30.1    22.7    21.8    23.5   21.7
        write_dict                      31.4    33.3    29.3    29.2    24.7   25.4
        write_strdict                   28.4    29.9    27.5    25.2    23.1   24.5
    
    Stack (or queue) operations:
        list_append_pop                 93.4   112.7    75.4    74.2    50.8   50.6
        deque_append_pop                43.5    57.0    49.4    49.2    42.5   44.2
        deque_append_popleft            43.7    57.3    49.7    49.7    42.8   46.4
    
    Timing loop:
        loop_overhead                    0.5     0.6     0.4     0.3     0.3    0.3
    
    10 hiện phát ra
    int
    foo_traverse(foo_struct *self, visitproc visit, void *arg) {
    // Rest of the traverse function
    #if PY_VERSION_HEX >= 0x03090000
        // This was not needed before Python 3.9 (Python issue 35810 and 40217)
        Py_VISIT(Py_TYPE(self));
    #endif
    }
    
    4. Python 3.9 đã chuyển sang trình phân tích cú pháp PEG (xem PEP 617) và Python 3.10 có thể bao gồm cú pháp ngôn ngữ mới không thể phân tích được bởi trình phân tích cú pháp Lib2To3THER LL (1). Mô -đun
    Python version                       3.4     3.5     3.6     3.7     3.8    3.9
    --------------                       ---     ---     ---     ---     ---    ---
    
    Variable and attribute read access:
        read_local                       7.1     7.1     5.4     5.1     3.9    3.9
        read_nonlocal                    7.1     8.1     5.8     5.4     4.4    4.5
        read_global                     15.5    19.0    14.3    13.6     7.6    7.8
        read_builtin                    21.1    21.6    18.5    19.0     7.5    7.8
        read_classvar_from_class        25.6    26.5    20.7    19.5    18.4   17.9
        read_classvar_from_instance     22.8    23.5    18.8    17.1    16.4   16.9
        read_instancevar                32.4    33.1    28.0    26.3    25.4   25.3
        read_instancevar_slots          27.8    31.3    20.8    20.8    20.2   20.5
        read_namedtuple                 73.8    57.5    45.0    46.8    18.4   18.7
        read_boundmethod                37.6    37.9    29.6    26.9    27.7   41.1
    
    Variable and attribute write access:
        write_local                      8.7     9.3     5.5     5.3     4.3    4.3
        write_nonlocal                  10.5    11.1     5.6     5.5     4.7    4.8
        write_global                    19.7    21.2    18.0    18.0    15.8   16.7
        write_classvar                  92.9    96.0   104.6   102.1    39.2   39.8
        write_instancevar               44.6    45.8    40.0    38.9    35.5   37.4
        write_instancevar_slots         35.6    36.1    27.3    26.6    25.7   25.8
    
    Data structure read access:
        read_list                       24.2    24.5    20.8    20.8    19.0   19.5
        read_deque                      24.7    25.5    20.2    20.6    19.8   20.2
        read_dict                       24.3    25.7    22.3    23.0    21.0   22.4
        read_strdict                    22.6    24.3    19.5    21.2    18.9   21.5
    
    Data structure write access:
        write_list                      27.1    28.5    22.5    21.6    20.0   20.0
        write_deque                     28.7    30.1    22.7    21.8    23.5   21.7
        write_dict                      31.4    33.3    29.3    29.2    24.7   25.4
        write_strdict                   28.4    29.9    27.5    25.2    23.1   24.5
    
    Stack (or queue) operations:
        list_append_pop                 93.4   112.7    75.4    74.2    50.8   50.6
        deque_append_pop                43.5    57.0    49.4    49.2    42.5   44.2
        deque_append_popleft            43.7    57.3    49.7    49.7    42.8   46.4
    
    Timing loop:
        loop_overhead                    0.5     0.6     0.4     0.3     0.3    0.3
    
    10 có thể bị xóa khỏi thư viện tiêu chuẩn trong phiên bản Python trong tương lai. Hãy xem xét các lựa chọn thay thế của bên thứ ba như Libcst hoặc PARSO. (Được đóng góp bởi Carl Meyer trong BPO-40360.)PEP 617), and Python 3.10 may include new language syntax that is not parsable by lib2to3’s LL(1) parser. The
    Python version                       3.4     3.5     3.6     3.7     3.8    3.9
    --------------                       ---     ---     ---     ---     ---    ---
    
    Variable and attribute read access:
        read_local                       7.1     7.1     5.4     5.1     3.9    3.9
        read_nonlocal                    7.1     8.1     5.8     5.4     4.4    4.5
        read_global                     15.5    19.0    14.3    13.6     7.6    7.8
        read_builtin                    21.1    21.6    18.5    19.0     7.5    7.8
        read_classvar_from_class        25.6    26.5    20.7    19.5    18.4   17.9
        read_classvar_from_instance     22.8    23.5    18.8    17.1    16.4   16.9
        read_instancevar                32.4    33.1    28.0    26.3    25.4   25.3
        read_instancevar_slots          27.8    31.3    20.8    20.8    20.2   20.5
        read_namedtuple                 73.8    57.5    45.0    46.8    18.4   18.7
        read_boundmethod                37.6    37.9    29.6    26.9    27.7   41.1
    
    Variable and attribute write access:
        write_local                      8.7     9.3     5.5     5.3     4.3    4.3
        write_nonlocal                  10.5    11.1     5.6     5.5     4.7    4.8
        write_global                    19.7    21.2    18.0    18.0    15.8   16.7
        write_classvar                  92.9    96.0   104.6   102.1    39.2   39.8
        write_instancevar               44.6    45.8    40.0    38.9    35.5   37.4
        write_instancevar_slots         35.6    36.1    27.3    26.6    25.7   25.8
    
    Data structure read access:
        read_list                       24.2    24.5    20.8    20.8    19.0   19.5
        read_deque                      24.7    25.5    20.2    20.6    19.8   20.2
        read_dict                       24.3    25.7    22.3    23.0    21.0   22.4
        read_strdict                    22.6    24.3    19.5    21.2    18.9   21.5
    
    Data structure write access:
        write_list                      27.1    28.5    22.5    21.6    20.0   20.0
        write_deque                     28.7    30.1    22.7    21.8    23.5   21.7
        write_dict                      31.4    33.3    29.3    29.2    24.7   25.4
        write_strdict                   28.4    29.9    27.5    25.2    23.1   24.5
    
    Stack (or queue) operations:
        list_append_pop                 93.4   112.7    75.4    74.2    50.8   50.6
        deque_append_pop                43.5    57.0    49.4    49.2    42.5   44.2
        deque_append_popleft            43.7    57.3    49.7    49.7    42.8   46.4
    
    Timing loop:
        loop_overhead                    0.5     0.6     0.4     0.3     0.3    0.3
    
    10 module may be removed from the standard library in a future Python version. Consider third-party alternatives such as LibCST or parso. (Contributed by Carl Meyer in bpo-40360.)

  • Tham số ngẫu nhiên của

    Python version                       3.4     3.5     3.6     3.7     3.8    3.9
    --------------                       ---     ---     ---     ---     ---    ---
    
    Variable and attribute read access:
        read_local                       7.1     7.1     5.4     5.1     3.9    3.9
        read_nonlocal                    7.1     8.1     5.8     5.4     4.4    4.5
        read_global                     15.5    19.0    14.3    13.6     7.6    7.8
        read_builtin                    21.1    21.6    18.5    19.0     7.5    7.8
        read_classvar_from_class        25.6    26.5    20.7    19.5    18.4   17.9
        read_classvar_from_instance     22.8    23.5    18.8    17.1    16.4   16.9
        read_instancevar                32.4    33.1    28.0    26.3    25.4   25.3
        read_instancevar_slots          27.8    31.3    20.8    20.8    20.2   20.5
        read_namedtuple                 73.8    57.5    45.0    46.8    18.4   18.7
        read_boundmethod                37.6    37.9    29.6    26.9    27.7   41.1
    
    Variable and attribute write access:
        write_local                      8.7     9.3     5.5     5.3     4.3    4.3
        write_nonlocal                  10.5    11.1     5.6     5.5     4.7    4.8
        write_global                    19.7    21.2    18.0    18.0    15.8   16.7
        write_classvar                  92.9    96.0   104.6   102.1    39.2   39.8
        write_instancevar               44.6    45.8    40.0    38.9    35.5   37.4
        write_instancevar_slots         35.6    36.1    27.3    26.6    25.7   25.8
    
    Data structure read access:
        read_list                       24.2    24.5    20.8    20.8    19.0   19.5
        read_deque                      24.7    25.5    20.2    20.6    19.8   20.2
        read_dict                       24.3    25.7    22.3    23.0    21.0   22.4
        read_strdict                    22.6    24.3    19.5    21.2    18.9   21.5
    
    Data structure write access:
        write_list                      27.1    28.5    22.5    21.6    20.0   20.0
        write_deque                     28.7    30.1    22.7    21.8    23.5   21.7
        write_dict                      31.4    33.3    29.3    29.2    24.7   25.4
        write_strdict                   28.4    29.9    27.5    25.2    23.1   24.5
    
    Stack (or queue) operations:
        list_append_pop                 93.4   112.7    75.4    74.2    50.8   50.6
        deque_append_pop                43.5    57.0    49.4    49.2    42.5   44.2
        deque_append_popleft            43.7    57.3    49.7    49.7    42.8   46.4
    
    Timing loop:
        loop_overhead                    0.5     0.6     0.4     0.3     0.3    0.3
    
    13 đã được không dùng nữa. (Được đóng góp bởi Raymond Hettinger trong BPO-40465)

Loại bỏ¶

  • Phiên bản sai lầm tại

    Python version                       3.4     3.5     3.6     3.7     3.8    3.9
    --------------                       ---     ---     ---     ---     ---    ---
    
    Variable and attribute read access:
        read_local                       7.1     7.1     5.4     5.1     3.9    3.9
        read_nonlocal                    7.1     8.1     5.8     5.4     4.4    4.5
        read_global                     15.5    19.0    14.3    13.6     7.6    7.8
        read_builtin                    21.1    21.6    18.5    19.0     7.5    7.8
        read_classvar_from_class        25.6    26.5    20.7    19.5    18.4   17.9
        read_classvar_from_instance     22.8    23.5    18.8    17.1    16.4   16.9
        read_instancevar                32.4    33.1    28.0    26.3    25.4   25.3
        read_instancevar_slots          27.8    31.3    20.8    20.8    20.2   20.5
        read_namedtuple                 73.8    57.5    45.0    46.8    18.4   18.7
        read_boundmethod                37.6    37.9    29.6    26.9    27.7   41.1
    
    Variable and attribute write access:
        write_local                      8.7     9.3     5.5     5.3     4.3    4.3
        write_nonlocal                  10.5    11.1     5.6     5.5     4.7    4.8
        write_global                    19.7    21.2    18.0    18.0    15.8   16.7
        write_classvar                  92.9    96.0   104.6   102.1    39.2   39.8
        write_instancevar               44.6    45.8    40.0    38.9    35.5   37.4
        write_instancevar_slots         35.6    36.1    27.3    26.6    25.7   25.8
    
    Data structure read access:
        read_list                       24.2    24.5    20.8    20.8    19.0   19.5
        read_deque                      24.7    25.5    20.2    20.6    19.8   20.2
        read_dict                       24.3    25.7    22.3    23.0    21.0   22.4
        read_strdict                    22.6    24.3    19.5    21.2    18.9   21.5
    
    Data structure write access:
        write_list                      27.1    28.5    22.5    21.6    20.0   20.0
        write_deque                     28.7    30.1    22.7    21.8    23.5   21.7
        write_dict                      31.4    33.3    29.3    29.2    24.7   25.4
        write_strdict                   28.4    29.9    27.5    25.2    23.1   24.5
    
    Stack (or queue) operations:
        list_append_pop                 93.4   112.7    75.4    74.2    50.8   50.6
        deque_append_pop                43.5    57.0    49.4    49.2    42.5   44.2
        deque_append_popleft            43.7    57.3    49.7    49.7    42.8   46.4
    
    Timing loop:
        loop_overhead                    0.5     0.6     0.4     0.3     0.3    0.3
    
    14 đã bị xóa.

  • Python version                       3.4     3.5     3.6     3.7     3.8    3.9
    --------------                       ---     ---     ---     ---     ---    ---
    
    Variable and attribute read access:
        read_local                       7.1     7.1     5.4     5.1     3.9    3.9
        read_nonlocal                    7.1     8.1     5.8     5.4     4.4    4.5
        read_global                     15.5    19.0    14.3    13.6     7.6    7.8
        read_builtin                    21.1    21.6    18.5    19.0     7.5    7.8
        read_classvar_from_class        25.6    26.5    20.7    19.5    18.4   17.9
        read_classvar_from_instance     22.8    23.5    18.8    17.1    16.4   16.9
        read_instancevar                32.4    33.1    28.0    26.3    25.4   25.3
        read_instancevar_slots          27.8    31.3    20.8    20.8    20.2   20.5
        read_namedtuple                 73.8    57.5    45.0    46.8    18.4   18.7
        read_boundmethod                37.6    37.9    29.6    26.9    27.7   41.1
    
    Variable and attribute write access:
        write_local                      8.7     9.3     5.5     5.3     4.3    4.3
        write_nonlocal                  10.5    11.1     5.6     5.5     4.7    4.8
        write_global                    19.7    21.2    18.0    18.0    15.8   16.7
        write_classvar                  92.9    96.0   104.6   102.1    39.2   39.8
        write_instancevar               44.6    45.8    40.0    38.9    35.5   37.4
        write_instancevar_slots         35.6    36.1    27.3    26.6    25.7   25.8
    
    Data structure read access:
        read_list                       24.2    24.5    20.8    20.8    19.0   19.5
        read_deque                      24.7    25.5    20.2    20.6    19.8   20.2
        read_dict                       24.3    25.7    22.3    23.0    21.0   22.4
        read_strdict                    22.6    24.3    19.5    21.2    18.9   21.5
    
    Data structure write access:
        write_list                      27.1    28.5    22.5    21.6    20.0   20.0
        write_deque                     28.7    30.1    22.7    21.8    23.5   21.7
        write_dict                      31.4    33.3    29.3    29.2    24.7   25.4
        write_strdict                   28.4    29.9    27.5    25.2    23.1   24.5
    
    Stack (or queue) operations:
        list_append_pop                 93.4   112.7    75.4    74.2    50.8   50.6
        deque_append_pop                43.5    57.0    49.4    49.2    42.5   44.2
        deque_append_popleft            43.7    57.3    49.7    49.7    42.8   46.4
    
    Timing loop:
        loop_overhead                    0.5     0.6     0.4     0.3     0.3    0.3
    
    15:
    Python version                       3.4     3.5     3.6     3.7     3.8    3.9
    --------------                       ---     ---     ---     ---     ---    ---
    
    Variable and attribute read access:
        read_local                       7.1     7.1     5.4     5.1     3.9    3.9
        read_nonlocal                    7.1     8.1     5.8     5.4     4.4    4.5
        read_global                     15.5    19.0    14.3    13.6     7.6    7.8
        read_builtin                    21.1    21.6    18.5    19.0     7.5    7.8
        read_classvar_from_class        25.6    26.5    20.7    19.5    18.4   17.9
        read_classvar_from_instance     22.8    23.5    18.8    17.1    16.4   16.9
        read_instancevar                32.4    33.1    28.0    26.3    25.4   25.3
        read_instancevar_slots          27.8    31.3    20.8    20.8    20.2   20.5
        read_namedtuple                 73.8    57.5    45.0    46.8    18.4   18.7
        read_boundmethod                37.6    37.9    29.6    26.9    27.7   41.1
    
    Variable and attribute write access:
        write_local                      8.7     9.3     5.5     5.3     4.3    4.3
        write_nonlocal                  10.5    11.1     5.6     5.5     4.7    4.8
        write_global                    19.7    21.2    18.0    18.0    15.8   16.7
        write_classvar                  92.9    96.0   104.6   102.1    39.2   39.8
        write_instancevar               44.6    45.8    40.0    38.9    35.5   37.4
        write_instancevar_slots         35.6    36.1    27.3    26.6    25.7   25.8
    
    Data structure read access:
        read_list                       24.2    24.5    20.8    20.8    19.0   19.5
        read_deque                      24.7    25.5    20.2    20.6    19.8   20.2
        read_dict                       24.3    25.7    22.3    23.0    21.0   22.4
        read_strdict                    22.6    24.3    19.5    21.2    18.9   21.5
    
    Data structure write access:
        write_list                      27.1    28.5    22.5    21.6    20.0   20.0
        write_deque                     28.7    30.1    22.7    21.8    23.5   21.7
        write_dict                      31.4    33.3    29.3    29.2    24.7   25.4
        write_strdict                   28.4    29.9    27.5    25.2    23.1   24.5
    
    Stack (or queue) operations:
        list_append_pop                 93.4   112.7    75.4    74.2    50.8   50.6
        deque_append_pop                43.5    57.0    49.4    49.2    42.5   44.2
        deque_append_popleft            43.7    57.3    49.7    49.7    42.8   46.4
    
    Timing loop:
        loop_overhead                    0.5     0.6     0.4     0.3     0.3    0.3
    
    16 và
    Python version                       3.4     3.5     3.6     3.7     3.8    3.9
    --------------                       ---     ---     ---     ---     ---    ---
    
    Variable and attribute read access:
        read_local                       7.1     7.1     5.4     5.1     3.9    3.9
        read_nonlocal                    7.1     8.1     5.8     5.4     4.4    4.5
        read_global                     15.5    19.0    14.3    13.6     7.6    7.8
        read_builtin                    21.1    21.6    18.5    19.0     7.5    7.8
        read_classvar_from_class        25.6    26.5    20.7    19.5    18.4   17.9
        read_classvar_from_instance     22.8    23.5    18.8    17.1    16.4   16.9
        read_instancevar                32.4    33.1    28.0    26.3    25.4   25.3
        read_instancevar_slots          27.8    31.3    20.8    20.8    20.2   20.5
        read_namedtuple                 73.8    57.5    45.0    46.8    18.4   18.7
        read_boundmethod                37.6    37.9    29.6    26.9    27.7   41.1
    
    Variable and attribute write access:
        write_local                      8.7     9.3     5.5     5.3     4.3    4.3
        write_nonlocal                  10.5    11.1     5.6     5.5     4.7    4.8
        write_global                    19.7    21.2    18.0    18.0    15.8   16.7
        write_classvar                  92.9    96.0   104.6   102.1    39.2   39.8
        write_instancevar               44.6    45.8    40.0    38.9    35.5   37.4
        write_instancevar_slots         35.6    36.1    27.3    26.6    25.7   25.8
    
    Data structure read access:
        read_list                       24.2    24.5    20.8    20.8    19.0   19.5
        read_deque                      24.7    25.5    20.2    20.6    19.8   20.2
        read_dict                       24.3    25.7    22.3    23.0    21.0   22.4
        read_strdict                    22.6    24.3    19.5    21.2    18.9   21.5
    
    Data structure write access:
        write_list                      27.1    28.5    22.5    21.6    20.0   20.0
        write_deque                     28.7    30.1    22.7    21.8    23.5   21.7
        write_dict                      31.4    33.3    29.3    29.2    24.7   25.4
        write_strdict                   28.4    29.9    27.5    25.2    23.1   24.5
    
    Stack (or queue) operations:
        list_append_pop                 93.4   112.7    75.4    74.2    50.8   50.6
        deque_append_pop                43.5    57.0    49.4    49.2    42.5   44.2
        deque_append_popleft            43.7    57.3    49.7    49.7    42.8   46.4
    
    Timing loop:
        loop_overhead                    0.5     0.6     0.4     0.3     0.3    0.3
    
    17 đã được loại bỏ. Các phương pháp này không được chấp nhận kể từ Python 3.3. Nói chung, các tiện ích mở rộng này không được hỗ trợ hoặc không được kích hoạt bởi các quản trị viên máy chủ NNTP. Đối với
    Python version                       3.4     3.5     3.6     3.7     3.8    3.9
    --------------                       ---     ---     ---     ---     ---    ---
    
    Variable and attribute read access:
        read_local                       7.1     7.1     5.4     5.1     3.9    3.9
        read_nonlocal                    7.1     8.1     5.8     5.4     4.4    4.5
        read_global                     15.5    19.0    14.3    13.6     7.6    7.8
        read_builtin                    21.1    21.6    18.5    19.0     7.5    7.8
        read_classvar_from_class        25.6    26.5    20.7    19.5    18.4   17.9
        read_classvar_from_instance     22.8    23.5    18.8    17.1    16.4   16.9
        read_instancevar                32.4    33.1    28.0    26.3    25.4   25.3
        read_instancevar_slots          27.8    31.3    20.8    20.8    20.2   20.5
        read_namedtuple                 73.8    57.5    45.0    46.8    18.4   18.7
        read_boundmethod                37.6    37.9    29.6    26.9    27.7   41.1
    
    Variable and attribute write access:
        write_local                      8.7     9.3     5.5     5.3     4.3    4.3
        write_nonlocal                  10.5    11.1     5.6     5.5     4.7    4.8
        write_global                    19.7    21.2    18.0    18.0    15.8   16.7
        write_classvar                  92.9    96.0   104.6   102.1    39.2   39.8
        write_instancevar               44.6    45.8    40.0    38.9    35.5   37.4
        write_instancevar_slots         35.6    36.1    27.3    26.6    25.7   25.8
    
    Data structure read access:
        read_list                       24.2    24.5    20.8    20.8    19.0   19.5
        read_deque                      24.7    25.5    20.2    20.6    19.8   20.2
        read_dict                       24.3    25.7    22.3    23.0    21.0   22.4
        read_strdict                    22.6    24.3    19.5    21.2    18.9   21.5
    
    Data structure write access:
        write_list                      27.1    28.5    22.5    21.6    20.0   20.0
        write_deque                     28.7    30.1    22.7    21.8    23.5   21.7
        write_dict                      31.4    33.3    29.3    29.2    24.7   25.4
        write_strdict                   28.4    29.9    27.5    25.2    23.1   24.5
    
    Stack (or queue) operations:
        list_append_pop                 93.4   112.7    75.4    74.2    50.8   50.6
        deque_append_pop                43.5    57.0    49.4    49.2    42.5   44.2
        deque_append_popleft            43.7    57.3    49.7    49.7    42.8   46.4
    
    Timing loop:
        loop_overhead                    0.5     0.6     0.4     0.3     0.3    0.3
    
    17, vui lòng sử dụng
    Python version                       3.4     3.5     3.6     3.7     3.8    3.9
    --------------                       ---     ---     ---     ---     ---    ---
    
    Variable and attribute read access:
        read_local                       7.1     7.1     5.4     5.1     3.9    3.9
        read_nonlocal                    7.1     8.1     5.8     5.4     4.4    4.5
        read_global                     15.5    19.0    14.3    13.6     7.6    7.8
        read_builtin                    21.1    21.6    18.5    19.0     7.5    7.8
        read_classvar_from_class        25.6    26.5    20.7    19.5    18.4   17.9
        read_classvar_from_instance     22.8    23.5    18.8    17.1    16.4   16.9
        read_instancevar                32.4    33.1    28.0    26.3    25.4   25.3
        read_instancevar_slots          27.8    31.3    20.8    20.8    20.2   20.5
        read_namedtuple                 73.8    57.5    45.0    46.8    18.4   18.7
        read_boundmethod                37.6    37.9    29.6    26.9    27.7   41.1
    
    Variable and attribute write access:
        write_local                      8.7     9.3     5.5     5.3     4.3    4.3
        write_nonlocal                  10.5    11.1     5.6     5.5     4.7    4.8
        write_global                    19.7    21.2    18.0    18.0    15.8   16.7
        write_classvar                  92.9    96.0   104.6   102.1    39.2   39.8
        write_instancevar               44.6    45.8    40.0    38.9    35.5   37.4
        write_instancevar_slots         35.6    36.1    27.3    26.6    25.7   25.8
    
    Data structure read access:
        read_list                       24.2    24.5    20.8    20.8    19.0   19.5
        read_deque                      24.7    25.5    20.2    20.6    19.8   20.2
        read_dict                       24.3    25.7    22.3    23.0    21.0   22.4
        read_strdict                    22.6    24.3    19.5    21.2    18.9   21.5
    
    Data structure write access:
        write_list                      27.1    28.5    22.5    21.6    20.0   20.0
        write_deque                     28.7    30.1    22.7    21.8    23.5   21.7
        write_dict                      31.4    33.3    29.3    29.2    24.7   25.4
        write_strdict                   28.4    29.9    27.5    25.2    23.1   24.5
    
    Stack (or queue) operations:
        list_append_pop                 93.4   112.7    75.4    74.2    50.8   50.6
        deque_append_pop                43.5    57.0    49.4    49.2    42.5   44.2
        deque_append_popleft            43.7    57.3    49.7    49.7    42.8   46.4
    
    Timing loop:
        loop_overhead                    0.5     0.6     0.4     0.3     0.3    0.3
    
    19 hoặc
    Python version                       3.4     3.5     3.6     3.7     3.8    3.9
    --------------                       ---     ---     ---     ---     ---    ---
    
    Variable and attribute read access:
        read_local                       7.1     7.1     5.4     5.1     3.9    3.9
        read_nonlocal                    7.1     8.1     5.8     5.4     4.4    4.5
        read_global                     15.5    19.0    14.3    13.6     7.6    7.8
        read_builtin                    21.1    21.6    18.5    19.0     7.5    7.8
        read_classvar_from_class        25.6    26.5    20.7    19.5    18.4   17.9
        read_classvar_from_instance     22.8    23.5    18.8    17.1    16.4   16.9
        read_instancevar                32.4    33.1    28.0    26.3    25.4   25.3
        read_instancevar_slots          27.8    31.3    20.8    20.8    20.2   20.5
        read_namedtuple                 73.8    57.5    45.0    46.8    18.4   18.7
        read_boundmethod                37.6    37.9    29.6    26.9    27.7   41.1
    
    Variable and attribute write access:
        write_local                      8.7     9.3     5.5     5.3     4.3    4.3
        write_nonlocal                  10.5    11.1     5.6     5.5     4.7    4.8
        write_global                    19.7    21.2    18.0    18.0    15.8   16.7
        write_classvar                  92.9    96.0   104.6   102.1    39.2   39.8
        write_instancevar               44.6    45.8    40.0    38.9    35.5   37.4
        write_instancevar_slots         35.6    36.1    27.3    26.6    25.7   25.8
    
    Data structure read access:
        read_list                       24.2    24.5    20.8    20.8    19.0   19.5
        read_deque                      24.7    25.5    20.2    20.6    19.8   20.2
        read_dict                       24.3    25.7    22.3    23.0    21.0   22.4
        read_strdict                    22.6    24.3    19.5    21.2    18.9   21.5
    
    Data structure write access:
        write_list                      27.1    28.5    22.5    21.6    20.0   20.0
        write_deque                     28.7    30.1    22.7    21.8    23.5   21.7
        write_dict                      31.4    33.3    29.3    29.2    24.7   25.4
        write_strdict                   28.4    29.9    27.5    25.2    23.1   24.5
    
    Stack (or queue) operations:
        list_append_pop                 93.4   112.7    75.4    74.2    50.8   50.6
        deque_append_pop                43.5    57.0    49.4    49.2    42.5   44.2
        deque_append_popleft            43.7    57.3    49.7    49.7    42.8   46.4
    
    Timing loop:
        loop_overhead                    0.5     0.6     0.4     0.3     0.3    0.3
    
    20 thay thế. (Được đóng góp bởi Dong-hee NA trong BPO-39366.)

  • Python version                       3.4     3.5     3.6     3.7     3.8    3.9
    --------------                       ---     ---     ---     ---     ---    ---
    
    Variable and attribute read access:
        read_local                       7.1     7.1     5.4     5.1     3.9    3.9
        read_nonlocal                    7.1     8.1     5.8     5.4     4.4    4.5
        read_global                     15.5    19.0    14.3    13.6     7.6    7.8
        read_builtin                    21.1    21.6    18.5    19.0     7.5    7.8
        read_classvar_from_class        25.6    26.5    20.7    19.5    18.4   17.9
        read_classvar_from_instance     22.8    23.5    18.8    17.1    16.4   16.9
        read_instancevar                32.4    33.1    28.0    26.3    25.4   25.3
        read_instancevar_slots          27.8    31.3    20.8    20.8    20.2   20.5
        read_namedtuple                 73.8    57.5    45.0    46.8    18.4   18.7
        read_boundmethod                37.6    37.9    29.6    26.9    27.7   41.1
    
    Variable and attribute write access:
        write_local                      8.7     9.3     5.5     5.3     4.3    4.3
        write_nonlocal                  10.5    11.1     5.6     5.5     4.7    4.8
        write_global                    19.7    21.2    18.0    18.0    15.8   16.7
        write_classvar                  92.9    96.0   104.6   102.1    39.2   39.8
        write_instancevar               44.6    45.8    40.0    38.9    35.5   37.4
        write_instancevar_slots         35.6    36.1    27.3    26.6    25.7   25.8
    
    Data structure read access:
        read_list                       24.2    24.5    20.8    20.8    19.0   19.5
        read_deque                      24.7    25.5    20.2    20.6    19.8   20.2
        read_dict                       24.3    25.7    22.3    23.0    21.0   22.4
        read_strdict                    22.6    24.3    19.5    21.2    18.9   21.5
    
    Data structure write access:
        write_list                      27.1    28.5    22.5    21.6    20.0   20.0
        write_deque                     28.7    30.1    22.7    21.8    23.5   21.7
        write_dict                      31.4    33.3    29.3    29.2    24.7   25.4
        write_strdict                   28.4    29.9    27.5    25.2    23.1   24.5
    
    Stack (or queue) operations:
        list_append_pop                 93.4   112.7    75.4    74.2    50.8   50.6
        deque_append_pop                43.5    57.0    49.4    49.2    42.5   44.2
        deque_append_popleft            43.7    57.3    49.7    49.7    42.8   46.4
    
    Timing loop:
        loop_overhead                    0.5     0.6     0.4     0.3     0.3    0.3
    
    21:
    Python version                       3.4     3.5     3.6     3.7     3.8    3.9
    --------------                       ---     ---     ---     ---     ---    ---
    
    Variable and attribute read access:
        read_local                       7.1     7.1     5.4     5.1     3.9    3.9
        read_nonlocal                    7.1     8.1     5.8     5.4     4.4    4.5
        read_global                     15.5    19.0    14.3    13.6     7.6    7.8
        read_builtin                    21.1    21.6    18.5    19.0     7.5    7.8
        read_classvar_from_class        25.6    26.5    20.7    19.5    18.4   17.9
        read_classvar_from_instance     22.8    23.5    18.8    17.1    16.4   16.9
        read_instancevar                32.4    33.1    28.0    26.3    25.4   25.3
        read_instancevar_slots          27.8    31.3    20.8    20.8    20.2   20.5
        read_namedtuple                 73.8    57.5    45.0    46.8    18.4   18.7
        read_boundmethod                37.6    37.9    29.6    26.9    27.7   41.1
    
    Variable and attribute write access:
        write_local                      8.7     9.3     5.5     5.3     4.3    4.3
        write_nonlocal                  10.5    11.1     5.6     5.5     4.7    4.8
        write_global                    19.7    21.2    18.0    18.0    15.8   16.7
        write_classvar                  92.9    96.0   104.6   102.1    39.2   39.8
        write_instancevar               44.6    45.8    40.0    38.9    35.5   37.4
        write_instancevar_slots         35.6    36.1    27.3    26.6    25.7   25.8
    
    Data structure read access:
        read_list                       24.2    24.5    20.8    20.8    19.0   19.5
        read_deque                      24.7    25.5    20.2    20.6    19.8   20.2
        read_dict                       24.3    25.7    22.3    23.0    21.0   22.4
        read_strdict                    22.6    24.3    19.5    21.2    18.9   21.5
    
    Data structure write access:
        write_list                      27.1    28.5    22.5    21.6    20.0   20.0
        write_deque                     28.7    30.1    22.7    21.8    23.5   21.7
        write_dict                      31.4    33.3    29.3    29.2    24.7   25.4
        write_strdict                   28.4    29.9    27.5    25.2    23.1   24.5
    
    Stack (or queue) operations:
        list_append_pop                 93.4   112.7    75.4    74.2    50.8   50.6
        deque_append_pop                43.5    57.0    49.4    49.2    42.5   44.2
        deque_append_popleft            43.7    57.3    49.7    49.7    42.8   46.4
    
    Timing loop:
        loop_overhead                    0.5     0.6     0.4     0.3     0.3    0.3
    
    22 và
    Python version                       3.4     3.5     3.6     3.7     3.8    3.9
    --------------                       ---     ---     ---     ---     ---    ---
    
    Variable and attribute read access:
        read_local                       7.1     7.1     5.4     5.1     3.9    3.9
        read_nonlocal                    7.1     8.1     5.8     5.4     4.4    4.5
        read_global                     15.5    19.0    14.3    13.6     7.6    7.8
        read_builtin                    21.1    21.6    18.5    19.0     7.5    7.8
        read_classvar_from_class        25.6    26.5    20.7    19.5    18.4   17.9
        read_classvar_from_instance     22.8    23.5    18.8    17.1    16.4   16.9
        read_instancevar                32.4    33.1    28.0    26.3    25.4   25.3
        read_instancevar_slots          27.8    31.3    20.8    20.8    20.2   20.5
        read_namedtuple                 73.8    57.5    45.0    46.8    18.4   18.7
        read_boundmethod                37.6    37.9    29.6    26.9    27.7   41.1
    
    Variable and attribute write access:
        write_local                      8.7     9.3     5.5     5.3     4.3    4.3
        write_nonlocal                  10.5    11.1     5.6     5.5     4.7    4.8
        write_global                    19.7    21.2    18.0    18.0    15.8   16.7
        write_classvar                  92.9    96.0   104.6   102.1    39.2   39.8
        write_instancevar               44.6    45.8    40.0    38.9    35.5   37.4
        write_instancevar_slots         35.6    36.1    27.3    26.6    25.7   25.8
    
    Data structure read access:
        read_list                       24.2    24.5    20.8    20.8    19.0   19.5
        read_deque                      24.7    25.5    20.2    20.6    19.8   20.2
        read_dict                       24.3    25.7    22.3    23.0    21.0   22.4
        read_strdict                    22.6    24.3    19.5    21.2    18.9   21.5
    
    Data structure write access:
        write_list                      27.1    28.5    22.5    21.6    20.0   20.0
        write_deque                     28.7    30.1    22.7    21.8    23.5   21.7
        write_dict                      31.4    33.3    29.3    29.2    24.7   25.4
        write_strdict                   28.4    29.9    27.5    25.2    23.1   24.5
    
    Stack (or queue) operations:
        list_append_pop                 93.4   112.7    75.4    74.2    50.8   50.6
        deque_append_pop                43.5    57.0    49.4    49.2    42.5   44.2
        deque_append_popleft            43.7    57.3    49.7    49.7    42.8   46.4
    
    Timing loop:
        loop_overhead                    0.5     0.6     0.4     0.3     0.3    0.3
    
    23 đã bị loại bỏ. Chúng là bí danh của
    Python version                       3.4     3.5     3.6     3.7     3.8    3.9
    --------------                       ---     ---     ---     ---     ---    ---
    
    Variable and attribute read access:
        read_local                       7.1     7.1     5.4     5.1     3.9    3.9
        read_nonlocal                    7.1     8.1     5.8     5.4     4.4    4.5
        read_global                     15.5    19.0    14.3    13.6     7.6    7.8
        read_builtin                    21.1    21.6    18.5    19.0     7.5    7.8
        read_classvar_from_class        25.6    26.5    20.7    19.5    18.4   17.9
        read_classvar_from_instance     22.8    23.5    18.8    17.1    16.4   16.9
        read_instancevar                32.4    33.1    28.0    26.3    25.4   25.3
        read_instancevar_slots          27.8    31.3    20.8    20.8    20.2   20.5
        read_namedtuple                 73.8    57.5    45.0    46.8    18.4   18.7
        read_boundmethod                37.6    37.9    29.6    26.9    27.7   41.1
    
    Variable and attribute write access:
        write_local                      8.7     9.3     5.5     5.3     4.3    4.3
        write_nonlocal                  10.5    11.1     5.6     5.5     4.7    4.8
        write_global                    19.7    21.2    18.0    18.0    15.8   16.7
        write_classvar                  92.9    96.0   104.6   102.1    39.2   39.8
        write_instancevar               44.6    45.8    40.0    38.9    35.5   37.4
        write_instancevar_slots         35.6    36.1    27.3    26.6    25.7   25.8
    
    Data structure read access:
        read_list                       24.2    24.5    20.8    20.8    19.0   19.5
        read_deque                      24.7    25.5    20.2    20.6    19.8   20.2
        read_dict                       24.3    25.7    22.3    23.0    21.0   22.4
        read_strdict                    22.6    24.3    19.5    21.2    18.9   21.5
    
    Data structure write access:
        write_list                      27.1    28.5    22.5    21.6    20.0   20.0
        write_deque                     28.7    30.1    22.7    21.8    23.5   21.7
        write_dict                      31.4    33.3    29.3    29.2    24.7   25.4
        write_strdict                   28.4    29.9    27.5    25.2    23.1   24.5
    
    Stack (or queue) operations:
        list_append_pop                 93.4   112.7    75.4    74.2    50.8   50.6
        deque_append_pop                43.5    57.0    49.4    49.2    42.5   44.2
        deque_append_popleft            43.7    57.3    49.7    49.7    42.8   46.4
    
    Timing loop:
        loop_overhead                    0.5     0.6     0.4     0.3     0.3    0.3
    
    24 và
    Python version                       3.4     3.5     3.6     3.7     3.8    3.9
    --------------                       ---     ---     ---     ---     ---    ---
    
    Variable and attribute read access:
        read_local                       7.1     7.1     5.4     5.1     3.9    3.9
        read_nonlocal                    7.1     8.1     5.8     5.4     4.4    4.5
        read_global                     15.5    19.0    14.3    13.6     7.6    7.8
        read_builtin                    21.1    21.6    18.5    19.0     7.5    7.8
        read_classvar_from_class        25.6    26.5    20.7    19.5    18.4   17.9
        read_classvar_from_instance     22.8    23.5    18.8    17.1    16.4   16.9
        read_instancevar                32.4    33.1    28.0    26.3    25.4   25.3
        read_instancevar_slots          27.8    31.3    20.8    20.8    20.2   20.5
        read_namedtuple                 73.8    57.5    45.0    46.8    18.4   18.7
        read_boundmethod                37.6    37.9    29.6    26.9    27.7   41.1
    
    Variable and attribute write access:
        write_local                      8.7     9.3     5.5     5.3     4.3    4.3
        write_nonlocal                  10.5    11.1     5.6     5.5     4.7    4.8
        write_global                    19.7    21.2    18.0    18.0    15.8   16.7
        write_classvar                  92.9    96.0   104.6   102.1    39.2   39.8
        write_instancevar               44.6    45.8    40.0    38.9    35.5   37.4
        write_instancevar_slots         35.6    36.1    27.3    26.6    25.7   25.8
    
    Data structure read access:
        read_list                       24.2    24.5    20.8    20.8    19.0   19.5
        read_deque                      24.7    25.5    20.2    20.6    19.8   20.2
        read_dict                       24.3    25.7    22.3    23.0    21.0   22.4
        read_strdict                    22.6    24.3    19.5    21.2    18.9   21.5
    
    Data structure write access:
        write_list                      27.1    28.5    22.5    21.6    20.0   20.0
        write_deque                     28.7    30.1    22.7    21.8    23.5   21.7
        write_dict                      31.4    33.3    29.3    29.2    24.7   25.4
        write_strdict                   28.4    29.9    27.5    25.2    23.1   24.5
    
    Stack (or queue) operations:
        list_append_pop                 93.4   112.7    75.4    74.2    50.8   50.6
        deque_append_pop                43.5    57.0    49.4    49.2    42.5   44.2
        deque_append_popleft            43.7    57.3    49.7    49.7    42.8   46.4
    
    Timing loop:
        loop_overhead                    0.5     0.6     0.4     0.3     0.3    0.3
    
    25, không được chấp nhận kể từ Python 3.2. (Được đóng góp bởi Victor Stinner trong BPO-38916.)

  • Hàm

    Python version                       3.4     3.5     3.6     3.7     3.8    3.9
    --------------                       ---     ---     ---     ---     ---    ---
    
    Variable and attribute read access:
        read_local                       7.1     7.1     5.4     5.1     3.9    3.9
        read_nonlocal                    7.1     8.1     5.8     5.4     4.4    4.5
        read_global                     15.5    19.0    14.3    13.6     7.6    7.8
        read_builtin                    21.1    21.6    18.5    19.0     7.5    7.8
        read_classvar_from_class        25.6    26.5    20.7    19.5    18.4   17.9
        read_classvar_from_instance     22.8    23.5    18.8    17.1    16.4   16.9
        read_instancevar                32.4    33.1    28.0    26.3    25.4   25.3
        read_instancevar_slots          27.8    31.3    20.8    20.8    20.2   20.5
        read_namedtuple                 73.8    57.5    45.0    46.8    18.4   18.7
        read_boundmethod                37.6    37.9    29.6    26.9    27.7   41.1
    
    Variable and attribute write access:
        write_local                      8.7     9.3     5.5     5.3     4.3    4.3
        write_nonlocal                  10.5    11.1     5.6     5.5     4.7    4.8
        write_global                    19.7    21.2    18.0    18.0    15.8   16.7
        write_classvar                  92.9    96.0   104.6   102.1    39.2   39.8
        write_instancevar               44.6    45.8    40.0    38.9    35.5   37.4
        write_instancevar_slots         35.6    36.1    27.3    26.6    25.7   25.8
    
    Data structure read access:
        read_list                       24.2    24.5    20.8    20.8    19.0   19.5
        read_deque                      24.7    25.5    20.2    20.6    19.8   20.2
        read_dict                       24.3    25.7    22.3    23.0    21.0   22.4
        read_strdict                    22.6    24.3    19.5    21.2    18.9   21.5
    
    Data structure write access:
        write_list                      27.1    28.5    22.5    21.6    20.0   20.0
        write_deque                     28.7    30.1    22.7    21.8    23.5   21.7
        write_dict                      31.4    33.3    29.3    29.2    24.7   25.4
        write_strdict                   28.4    29.9    27.5    25.2    23.1   24.5
    
    Stack (or queue) operations:
        list_append_pop                 93.4   112.7    75.4    74.2    50.8   50.6
        deque_append_pop                43.5    57.0    49.4    49.2    42.5   44.2
        deque_append_popleft            43.7    57.3    49.7    49.7    42.8   46.4
    
    Timing loop:
        loop_overhead                    0.5     0.6     0.4     0.3     0.3    0.3
    
    26 không có giấy tờ đã bị loại bỏ. Kể từ Python 3.7, nó đã bị phản đối và luôn trả lại
    >>> from zoneinfo import ZoneInfo
    >>> from datetime import datetime, timedelta
    
    >>> # Daylight saving time
    >>> dt = datetime(2020, 10, 31, 12, tzinfo=ZoneInfo("America/Los_Angeles"))
    >>> print(dt)
    2020-10-31 12:00:00-07:00
    >>> dt.tzname()
    'PDT'
    
    >>> # Standard time
    >>> dt += timedelta(days=7)
    >>> print(dt)
    2020-11-07 12:00:00-08:00
    >>> print(dt.tzname())
    PST
    
    72. Nó yêu cầu một tùy chọn xây dựng đặc biệt
    Python version                       3.4     3.5     3.6     3.7     3.8    3.9
    --------------                       ---     ---     ---     ---     ---    ---
    
    Variable and attribute read access:
        read_local                       7.1     7.1     5.4     5.1     3.9    3.9
        read_nonlocal                    7.1     8.1     5.8     5.4     4.4    4.5
        read_global                     15.5    19.0    14.3    13.6     7.6    7.8
        read_builtin                    21.1    21.6    18.5    19.0     7.5    7.8
        read_classvar_from_class        25.6    26.5    20.7    19.5    18.4   17.9
        read_classvar_from_instance     22.8    23.5    18.8    17.1    16.4   16.9
        read_instancevar                32.4    33.1    28.0    26.3    25.4   25.3
        read_instancevar_slots          27.8    31.3    20.8    20.8    20.2   20.5
        read_namedtuple                 73.8    57.5    45.0    46.8    18.4   18.7
        read_boundmethod                37.6    37.9    29.6    26.9    27.7   41.1
    
    Variable and attribute write access:
        write_local                      8.7     9.3     5.5     5.3     4.3    4.3
        write_nonlocal                  10.5    11.1     5.6     5.5     4.7    4.8
        write_global                    19.7    21.2    18.0    18.0    15.8   16.7
        write_classvar                  92.9    96.0   104.6   102.1    39.2   39.8
        write_instancevar               44.6    45.8    40.0    38.9    35.5   37.4
        write_instancevar_slots         35.6    36.1    27.3    26.6    25.7   25.8
    
    Data structure read access:
        read_list                       24.2    24.5    20.8    20.8    19.0   19.5
        read_deque                      24.7    25.5    20.2    20.6    19.8   20.2
        read_dict                       24.3    25.7    22.3    23.0    21.0   22.4
        read_strdict                    22.6    24.3    19.5    21.2    18.9   21.5
    
    Data structure write access:
        write_list                      27.1    28.5    22.5    21.6    20.0   20.0
        write_deque                     28.7    30.1    22.7    21.8    23.5   21.7
        write_dict                      31.4    33.3    29.3    29.2    24.7   25.4
        write_strdict                   28.4    29.9    27.5    25.2    23.1   24.5
    
    Stack (or queue) operations:
        list_append_pop                 93.4   112.7    75.4    74.2    50.8   50.6
        deque_append_pop                43.5    57.0    49.4    49.2    42.5   44.2
        deque_append_popleft            43.7    57.3    49.7    49.7    42.8   46.4
    
    Timing loop:
        loop_overhead                    0.5     0.6     0.4     0.3     0.3    0.3
    
    28 đã bị xóa trong Python 3.7. (Được đóng góp bởi Victor Stinner trong BPO-37414.)

  • Các chức năng

    Python version                       3.4     3.5     3.6     3.7     3.8    3.9
    --------------                       ---     ---     ---     ---     ---    ---
    
    Variable and attribute read access:
        read_local                       7.1     7.1     5.4     5.1     3.9    3.9
        read_nonlocal                    7.1     8.1     5.8     5.4     4.4    4.5
        read_global                     15.5    19.0    14.3    13.6     7.6    7.8
        read_builtin                    21.1    21.6    18.5    19.0     7.5    7.8
        read_classvar_from_class        25.6    26.5    20.7    19.5    18.4   17.9
        read_classvar_from_instance     22.8    23.5    18.8    17.1    16.4   16.9
        read_instancevar                32.4    33.1    28.0    26.3    25.4   25.3
        read_instancevar_slots          27.8    31.3    20.8    20.8    20.2   20.5
        read_namedtuple                 73.8    57.5    45.0    46.8    18.4   18.7
        read_boundmethod                37.6    37.9    29.6    26.9    27.7   41.1
    
    Variable and attribute write access:
        write_local                      8.7     9.3     5.5     5.3     4.3    4.3
        write_nonlocal                  10.5    11.1     5.6     5.5     4.7    4.8
        write_global                    19.7    21.2    18.0    18.0    15.8   16.7
        write_classvar                  92.9    96.0   104.6   102.1    39.2   39.8
        write_instancevar               44.6    45.8    40.0    38.9    35.5   37.4
        write_instancevar_slots         35.6    36.1    27.3    26.6    25.7   25.8
    
    Data structure read access:
        read_list                       24.2    24.5    20.8    20.8    19.0   19.5
        read_deque                      24.7    25.5    20.2    20.6    19.8   20.2
        read_dict                       24.3    25.7    22.3    23.0    21.0   22.4
        read_strdict                    22.6    24.3    19.5    21.2    18.9   21.5
    
    Data structure write access:
        write_list                      27.1    28.5    22.5    21.6    20.0   20.0
        write_deque                     28.7    30.1    22.7    21.8    23.5   21.7
        write_dict                      31.4    33.3    29.3    29.2    24.7   25.4
        write_strdict                   28.4    29.9    27.5    25.2    23.1   24.5
    
    Stack (or queue) operations:
        list_append_pop                 93.4   112.7    75.4    74.2    50.8   50.6
        deque_append_pop                43.5    57.0    49.4    49.2    42.5   44.2
        deque_append_popleft            43.7    57.3    49.7    49.7    42.8   46.4
    
    Timing loop:
        loop_overhead                    0.5     0.6     0.4     0.3     0.3    0.3
    
    29 và
    Python version                       3.4     3.5     3.6     3.7     3.8    3.9
    --------------                       ---     ---     ---     ---     ---    ---
    
    Variable and attribute read access:
        read_local                       7.1     7.1     5.4     5.1     3.9    3.9
        read_nonlocal                    7.1     8.1     5.8     5.4     4.4    4.5
        read_global                     15.5    19.0    14.3    13.6     7.6    7.8
        read_builtin                    21.1    21.6    18.5    19.0     7.5    7.8
        read_classvar_from_class        25.6    26.5    20.7    19.5    18.4   17.9
        read_classvar_from_instance     22.8    23.5    18.8    17.1    16.4   16.9
        read_instancevar                32.4    33.1    28.0    26.3    25.4   25.3
        read_instancevar_slots          27.8    31.3    20.8    20.8    20.2   20.5
        read_namedtuple                 73.8    57.5    45.0    46.8    18.4   18.7
        read_boundmethod                37.6    37.9    29.6    26.9    27.7   41.1
    
    Variable and attribute write access:
        write_local                      8.7     9.3     5.5     5.3     4.3    4.3
        write_nonlocal                  10.5    11.1     5.6     5.5     4.7    4.8
        write_global                    19.7    21.2    18.0    18.0    15.8   16.7
        write_classvar                  92.9    96.0   104.6   102.1    39.2   39.8
        write_instancevar               44.6    45.8    40.0    38.9    35.5   37.4
        write_instancevar_slots         35.6    36.1    27.3    26.6    25.7   25.8
    
    Data structure read access:
        read_list                       24.2    24.5    20.8    20.8    19.0   19.5
        read_deque                      24.7    25.5    20.2    20.6    19.8   20.2
        read_dict                       24.3    25.7    22.3    23.0    21.0   22.4
        read_strdict                    22.6    24.3    19.5    21.2    18.9   21.5
    
    Data structure write access:
        write_list                      27.1    28.5    22.5    21.6    20.0   20.0
        write_deque                     28.7    30.1    22.7    21.8    23.5   21.7
        write_dict                      31.4    33.3    29.3    29.2    24.7   25.4
        write_strdict                   28.4    29.9    27.5    25.2    23.1   24.5
    
    Stack (or queue) operations:
        list_append_pop                 93.4   112.7    75.4    74.2    50.8   50.6
        deque_append_pop                43.5    57.0    49.4    49.2    42.5   44.2
        deque_append_popleft            43.7    57.3    49.7    49.7    42.8   46.4
    
    Timing loop:
        loop_overhead                    0.5     0.6     0.4     0.3     0.3    0.3
    
    30 đã bị xóa. Họ đã không được chấp nhận kể từ Python 3.2. Sử dụng
    Python version                       3.4     3.5     3.6     3.7     3.8    3.9
    --------------                       ---     ---     ---     ---     ---    ---
    
    Variable and attribute read access:
        read_local                       7.1     7.1     5.4     5.1     3.9    3.9
        read_nonlocal                    7.1     8.1     5.8     5.4     4.4    4.5
        read_global                     15.5    19.0    14.3    13.6     7.6    7.8
        read_builtin                    21.1    21.6    18.5    19.0     7.5    7.8
        read_classvar_from_class        25.6    26.5    20.7    19.5    18.4   17.9
        read_classvar_from_instance     22.8    23.5    18.8    17.1    16.4   16.9
        read_instancevar                32.4    33.1    28.0    26.3    25.4   25.3
        read_instancevar_slots          27.8    31.3    20.8    20.8    20.2   20.5
        read_namedtuple                 73.8    57.5    45.0    46.8    18.4   18.7
        read_boundmethod                37.6    37.9    29.6    26.9    27.7   41.1
    
    Variable and attribute write access:
        write_local                      8.7     9.3     5.5     5.3     4.3    4.3
        write_nonlocal                  10.5    11.1     5.6     5.5     4.7    4.8
        write_global                    19.7    21.2    18.0    18.0    15.8   16.7
        write_classvar                  92.9    96.0   104.6   102.1    39.2   39.8
        write_instancevar               44.6    45.8    40.0    38.9    35.5   37.4
        write_instancevar_slots         35.6    36.1    27.3    26.6    25.7   25.8
    
    Data structure read access:
        read_list                       24.2    24.5    20.8    20.8    19.0   19.5
        read_deque                      24.7    25.5    20.2    20.6    19.8   20.2
        read_dict                       24.3    25.7    22.3    23.0    21.0   22.4
        read_strdict                    22.6    24.3    19.5    21.2    18.9   21.5
    
    Data structure write access:
        write_list                      27.1    28.5    22.5    21.6    20.0   20.0
        write_deque                     28.7    30.1    22.7    21.8    23.5   21.7
        write_dict                      31.4    33.3    29.3    29.2    24.7   25.4
        write_strdict                   28.4    29.9    27.5    25.2    23.1   24.5
    
    Stack (or queue) operations:
        list_append_pop                 93.4   112.7    75.4    74.2    50.8   50.6
        deque_append_pop                43.5    57.0    49.4    49.2    42.5   44.2
        deque_append_popleft            43.7    57.3    49.7    49.7    42.8   46.4
    
    Timing loop:
        loop_overhead                    0.5     0.6     0.4     0.3     0.3    0.3
    
    31 và
    Python version                       3.4     3.5     3.6     3.7     3.8    3.9
    --------------                       ---     ---     ---     ---     ---    ---
    
    Variable and attribute read access:
        read_local                       7.1     7.1     5.4     5.1     3.9    3.9
        read_nonlocal                    7.1     8.1     5.8     5.4     4.4    4.5
        read_global                     15.5    19.0    14.3    13.6     7.6    7.8
        read_builtin                    21.1    21.6    18.5    19.0     7.5    7.8
        read_classvar_from_class        25.6    26.5    20.7    19.5    18.4   17.9
        read_classvar_from_instance     22.8    23.5    18.8    17.1    16.4   16.9
        read_instancevar                32.4    33.1    28.0    26.3    25.4   25.3
        read_instancevar_slots          27.8    31.3    20.8    20.8    20.2   20.5
        read_namedtuple                 73.8    57.5    45.0    46.8    18.4   18.7
        read_boundmethod                37.6    37.9    29.6    26.9    27.7   41.1
    
    Variable and attribute write access:
        write_local                      8.7     9.3     5.5     5.3     4.3    4.3
        write_nonlocal                  10.5    11.1     5.6     5.5     4.7    4.8
        write_global                    19.7    21.2    18.0    18.0    15.8   16.7
        write_classvar                  92.9    96.0   104.6   102.1    39.2   39.8
        write_instancevar               44.6    45.8    40.0    38.9    35.5   37.4
        write_instancevar_slots         35.6    36.1    27.3    26.6    25.7   25.8
    
    Data structure read access:
        read_list                       24.2    24.5    20.8    20.8    19.0   19.5
        read_deque                      24.7    25.5    20.2    20.6    19.8   20.2
        read_dict                       24.3    25.7    22.3    23.0    21.0   22.4
        read_strdict                    22.6    24.3    19.5    21.2    18.9   21.5
    
    Data structure write access:
        write_list                      27.1    28.5    22.5    21.6    20.0   20.0
        write_deque                     28.7    30.1    22.7    21.8    23.5   21.7
        write_dict                      31.4    33.3    29.3    29.2    24.7   25.4
        write_strdict                   28.4    29.9    27.5    25.2    23.1   24.5
    
    Stack (or queue) operations:
        list_append_pop                 93.4   112.7    75.4    74.2    50.8   50.6
        deque_append_pop                43.5    57.0    49.4    49.2    42.5   44.2
        deque_append_popleft            43.7    57.3    49.7    49.7    42.8   46.4
    
    Timing loop:
        loop_overhead                    0.5     0.6     0.4     0.3     0.3    0.3
    
    32 thay thế. (Được đóng góp bởi Victor Stinner trong BPO-37392.)

  • Hàm C

    Python version                       3.4     3.5     3.6     3.7     3.8    3.9
    --------------                       ---     ---     ---     ---     ---    ---
    
    Variable and attribute read access:
        read_local                       7.1     7.1     5.4     5.1     3.9    3.9
        read_nonlocal                    7.1     8.1     5.8     5.4     4.4    4.5
        read_global                     15.5    19.0    14.3    13.6     7.6    7.8
        read_builtin                    21.1    21.6    18.5    19.0     7.5    7.8
        read_classvar_from_class        25.6    26.5    20.7    19.5    18.4   17.9
        read_classvar_from_instance     22.8    23.5    18.8    17.1    16.4   16.9
        read_instancevar                32.4    33.1    28.0    26.3    25.4   25.3
        read_instancevar_slots          27.8    31.3    20.8    20.8    20.2   20.5
        read_namedtuple                 73.8    57.5    45.0    46.8    18.4   18.7
        read_boundmethod                37.6    37.9    29.6    26.9    27.7   41.1
    
    Variable and attribute write access:
        write_local                      8.7     9.3     5.5     5.3     4.3    4.3
        write_nonlocal                  10.5    11.1     5.6     5.5     4.7    4.8
        write_global                    19.7    21.2    18.0    18.0    15.8   16.7
        write_classvar                  92.9    96.0   104.6   102.1    39.2   39.8
        write_instancevar               44.6    45.8    40.0    38.9    35.5   37.4
        write_instancevar_slots         35.6    36.1    27.3    26.6    25.7   25.8
    
    Data structure read access:
        read_list                       24.2    24.5    20.8    20.8    19.0   19.5
        read_deque                      24.7    25.5    20.2    20.6    19.8   20.2
        read_dict                       24.3    25.7    22.3    23.0    21.0   22.4
        read_strdict                    22.6    24.3    19.5    21.2    18.9   21.5
    
    Data structure write access:
        write_list                      27.1    28.5    22.5    21.6    20.0   20.0
        write_deque                     28.7    30.1    22.7    21.8    23.5   21.7
        write_dict                      31.4    33.3    29.3    29.2    24.7   25.4
        write_strdict                   28.4    29.9    27.5    25.2    23.1   24.5
    
    Stack (or queue) operations:
        list_append_pop                 93.4   112.7    75.4    74.2    50.8   50.6
        deque_append_pop                43.5    57.0    49.4    49.2    42.5   44.2
        deque_append_popleft            43.7    57.3    49.7    49.7    42.8   46.4
    
    Timing loop:
        loop_overhead                    0.5     0.6     0.4     0.3     0.3    0.3
    
    33 đã được loại bỏ. Nó đã được ghi nhận là: trống rỗng bảng mô -đun. Chỉ sử dụng nội bộ. (Được đóng góp bởi Victor Stinner trong BPO-36710.)

  • Các mô -đun

    Python version                       3.4     3.5     3.6     3.7     3.8    3.9
    --------------                       ---     ---     ---     ---     ---    ---
    
    Variable and attribute read access:
        read_local                       7.1     7.1     5.4     5.1     3.9    3.9
        read_nonlocal                    7.1     8.1     5.8     5.4     4.4    4.5
        read_global                     15.5    19.0    14.3    13.6     7.6    7.8
        read_builtin                    21.1    21.6    18.5    19.0     7.5    7.8
        read_classvar_from_class        25.6    26.5    20.7    19.5    18.4   17.9
        read_classvar_from_instance     22.8    23.5    18.8    17.1    16.4   16.9
        read_instancevar                32.4    33.1    28.0    26.3    25.4   25.3
        read_instancevar_slots          27.8    31.3    20.8    20.8    20.2   20.5
        read_namedtuple                 73.8    57.5    45.0    46.8    18.4   18.7
        read_boundmethod                37.6    37.9    29.6    26.9    27.7   41.1
    
    Variable and attribute write access:
        write_local                      8.7     9.3     5.5     5.3     4.3    4.3
        write_nonlocal                  10.5    11.1     5.6     5.5     4.7    4.8
        write_global                    19.7    21.2    18.0    18.0    15.8   16.7
        write_classvar                  92.9    96.0   104.6   102.1    39.2   39.8
        write_instancevar               44.6    45.8    40.0    38.9    35.5   37.4
        write_instancevar_slots         35.6    36.1    27.3    26.6    25.7   25.8
    
    Data structure read access:
        read_list                       24.2    24.5    20.8    20.8    19.0   19.5
        read_deque                      24.7    25.5    20.2    20.6    19.8   20.2
        read_dict                       24.3    25.7    22.3    23.0    21.0   22.4
        read_strdict                    22.6    24.3    19.5    21.2    18.9   21.5
    
    Data structure write access:
        write_list                      27.1    28.5    22.5    21.6    20.0   20.0
        write_deque                     28.7    30.1    22.7    21.8    23.5   21.7
        write_dict                      31.4    33.3    29.3    29.2    24.7   25.4
        write_strdict                   28.4    29.9    27.5    25.2    23.1   24.5
    
    Stack (or queue) operations:
        list_append_pop                 93.4   112.7    75.4    74.2    50.8   50.6
        deque_append_pop                43.5    57.0    49.4    49.2    42.5   44.2
        deque_append_popleft            43.7    57.3    49.7    49.7    42.8   46.4
    
    Timing loop:
        loop_overhead                    0.5     0.6     0.4     0.3     0.3    0.3
    
    34 và
    Python version                       3.4     3.5     3.6     3.7     3.8    3.9
    --------------                       ---     ---     ---     ---     ---    ---
    
    Variable and attribute read access:
        read_local                       7.1     7.1     5.4     5.1     3.9    3.9
        read_nonlocal                    7.1     8.1     5.8     5.4     4.4    4.5
        read_global                     15.5    19.0    14.3    13.6     7.6    7.8
        read_builtin                    21.1    21.6    18.5    19.0     7.5    7.8
        read_classvar_from_class        25.6    26.5    20.7    19.5    18.4   17.9
        read_classvar_from_instance     22.8    23.5    18.8    17.1    16.4   16.9
        read_instancevar                32.4    33.1    28.0    26.3    25.4   25.3
        read_instancevar_slots          27.8    31.3    20.8    20.8    20.2   20.5
        read_namedtuple                 73.8    57.5    45.0    46.8    18.4   18.7
        read_boundmethod                37.6    37.9    29.6    26.9    27.7   41.1
    
    Variable and attribute write access:
        write_local                      8.7     9.3     5.5     5.3     4.3    4.3
        write_nonlocal                  10.5    11.1     5.6     5.5     4.7    4.8
        write_global                    19.7    21.2    18.0    18.0    15.8   16.7
        write_classvar                  92.9    96.0   104.6   102.1    39.2   39.8
        write_instancevar               44.6    45.8    40.0    38.9    35.5   37.4
        write_instancevar_slots         35.6    36.1    27.3    26.6    25.7   25.8
    
    Data structure read access:
        read_list                       24.2    24.5    20.8    20.8    19.0   19.5
        read_deque                      24.7    25.5    20.2    20.6    19.8   20.2
        read_dict                       24.3    25.7    22.3    23.0    21.0   22.4
        read_strdict                    22.6    24.3    19.5    21.2    18.9   21.5
    
    Data structure write access:
        write_list                      27.1    28.5    22.5    21.6    20.0   20.0
        write_deque                     28.7    30.1    22.7    21.8    23.5   21.7
        write_dict                      31.4    33.3    29.3    29.2    24.7   25.4
        write_strdict                   28.4    29.9    27.5    25.2    23.1   24.5
    
    Stack (or queue) operations:
        list_append_pop                 93.4   112.7    75.4    74.2    50.8   50.6
        deque_append_pop                43.5    57.0    49.4    49.2    42.5   44.2
        deque_append_popleft            43.7    57.3    49.7    49.7    42.8   46.4
    
    Timing loop:
        loop_overhead                    0.5     0.6     0.4     0.3     0.3    0.3
    
    35 đã được gỡ bỏ. Các mô -đun này đã được không dùng nữa kể từ khi Python 3.7 yêu cầu hỗ trợ luồng. (Được đóng góp bởi Victor Stinner trong BPO-37312.)

  • Python version                       3.4     3.5     3.6     3.7     3.8    3.9
    --------------                       ---     ---     ---     ---     ---    ---
    
    Variable and attribute read access:
        read_local                       7.1     7.1     5.4     5.1     3.9    3.9
        read_nonlocal                    7.1     8.1     5.8     5.4     4.4    4.5
        read_global                     15.5    19.0    14.3    13.6     7.6    7.8
        read_builtin                    21.1    21.6    18.5    19.0     7.5    7.8
        read_classvar_from_class        25.6    26.5    20.7    19.5    18.4   17.9
        read_classvar_from_instance     22.8    23.5    18.8    17.1    16.4   16.9
        read_instancevar                32.4    33.1    28.0    26.3    25.4   25.3
        read_instancevar_slots          27.8    31.3    20.8    20.8    20.2   20.5
        read_namedtuple                 73.8    57.5    45.0    46.8    18.4   18.7
        read_boundmethod                37.6    37.9    29.6    26.9    27.7   41.1
    
    Variable and attribute write access:
        write_local                      8.7     9.3     5.5     5.3     4.3    4.3
        write_nonlocal                  10.5    11.1     5.6     5.5     4.7    4.8
        write_global                    19.7    21.2    18.0    18.0    15.8   16.7
        write_classvar                  92.9    96.0   104.6   102.1    39.2   39.8
        write_instancevar               44.6    45.8    40.0    38.9    35.5   37.4
        write_instancevar_slots         35.6    36.1    27.3    26.6    25.7   25.8
    
    Data structure read access:
        read_list                       24.2    24.5    20.8    20.8    19.0   19.5
        read_deque                      24.7    25.5    20.2    20.6    19.8   20.2
        read_dict                       24.3    25.7    22.3    23.0    21.0   22.4
        read_strdict                    22.6    24.3    19.5    21.2    18.9   21.5
    
    Data structure write access:
        write_list                      27.1    28.5    22.5    21.6    20.0   20.0
        write_deque                     28.7    30.1    22.7    21.8    23.5   21.7
        write_dict                      31.4    33.3    29.3    29.2    24.7   25.4
        write_strdict                   28.4    29.9    27.5    25.2    23.1   24.5
    
    Stack (or queue) operations:
        list_append_pop                 93.4   112.7    75.4    74.2    50.8   50.6
        deque_append_pop                43.5    57.0    49.4    49.2    42.5   44.2
        deque_append_popleft            43.7    57.3    49.7    49.7    42.8   46.4
    
    Timing loop:
        loop_overhead                    0.5     0.6     0.4     0.3     0.3    0.3
    
    36 bí danh đối với
    Python version                       3.4     3.5     3.6     3.7     3.8    3.9
    --------------                       ---     ---     ---     ---     ---    ---
    
    Variable and attribute read access:
        read_local                       7.1     7.1     5.4     5.1     3.9    3.9
        read_nonlocal                    7.1     8.1     5.8     5.4     4.4    4.5
        read_global                     15.5    19.0    14.3    13.6     7.6    7.8
        read_builtin                    21.1    21.6    18.5    19.0     7.5    7.8
        read_classvar_from_class        25.6    26.5    20.7    19.5    18.4   17.9
        read_classvar_from_instance     22.8    23.5    18.8    17.1    16.4   16.9
        read_instancevar                32.4    33.1    28.0    26.3    25.4   25.3
        read_instancevar_slots          27.8    31.3    20.8    20.8    20.2   20.5
        read_namedtuple                 73.8    57.5    45.0    46.8    18.4   18.7
        read_boundmethod                37.6    37.9    29.6    26.9    27.7   41.1
    
    Variable and attribute write access:
        write_local                      8.7     9.3     5.5     5.3     4.3    4.3
        write_nonlocal                  10.5    11.1     5.6     5.5     4.7    4.8
        write_global                    19.7    21.2    18.0    18.0    15.8   16.7
        write_classvar                  92.9    96.0   104.6   102.1    39.2   39.8
        write_instancevar               44.6    45.8    40.0    38.9    35.5   37.4
        write_instancevar_slots         35.6    36.1    27.3    26.6    25.7   25.8
    
    Data structure read access:
        read_list                       24.2    24.5    20.8    20.8    19.0   19.5
        read_deque                      24.7    25.5    20.2    20.6    19.8   20.2
        read_dict                       24.3    25.7    22.3    23.0    21.0   22.4
        read_strdict                    22.6    24.3    19.5    21.2    18.9   21.5
    
    Data structure write access:
        write_list                      27.1    28.5    22.5    21.6    20.0   20.0
        write_deque                     28.7    30.1    22.7    21.8    23.5   21.7
        write_dict                      31.4    33.3    29.3    29.2    24.7   25.4
        write_strdict                   28.4    29.9    27.5    25.2    23.1   24.5
    
    Stack (or queue) operations:
        list_append_pop                 93.4   112.7    75.4    74.2    50.8   50.6
        deque_append_pop                43.5    57.0    49.4    49.2    42.5   44.2
        deque_append_popleft            43.7    57.3    49.7    49.7    42.8   46.4
    
    Timing loop:
        loop_overhead                    0.5     0.6     0.4     0.3     0.3    0.3
    
    37,
    Python version                       3.4     3.5     3.6     3.7     3.8    3.9
    --------------                       ---     ---     ---     ---     ---    ---
    
    Variable and attribute read access:
        read_local                       7.1     7.1     5.4     5.1     3.9    3.9
        read_nonlocal                    7.1     8.1     5.8     5.4     4.4    4.5
        read_global                     15.5    19.0    14.3    13.6     7.6    7.8
        read_builtin                    21.1    21.6    18.5    19.0     7.5    7.8
        read_classvar_from_class        25.6    26.5    20.7    19.5    18.4   17.9
        read_classvar_from_instance     22.8    23.5    18.8    17.1    16.4   16.9
        read_instancevar                32.4    33.1    28.0    26.3    25.4   25.3
        read_instancevar_slots          27.8    31.3    20.8    20.8    20.2   20.5
        read_namedtuple                 73.8    57.5    45.0    46.8    18.4   18.7
        read_boundmethod                37.6    37.9    29.6    26.9    27.7   41.1
    
    Variable and attribute write access:
        write_local                      8.7     9.3     5.5     5.3     4.3    4.3
        write_nonlocal                  10.5    11.1     5.6     5.5     4.7    4.8
        write_global                    19.7    21.2    18.0    18.0    15.8   16.7
        write_classvar                  92.9    96.0   104.6   102.1    39.2   39.8
        write_instancevar               44.6    45.8    40.0    38.9    35.5   37.4
        write_instancevar_slots         35.6    36.1    27.3    26.6    25.7   25.8
    
    Data structure read access:
        read_list                       24.2    24.5    20.8    20.8    19.0   19.5
        read_deque                      24.7    25.5    20.2    20.6    19.8   20.2
        read_dict                       24.3    25.7    22.3    23.0    21.0   22.4
        read_strdict                    22.6    24.3    19.5    21.2    18.9   21.5
    
    Data structure write access:
        write_list                      27.1    28.5    22.5    21.6    20.0   20.0
        write_deque                     28.7    30.1    22.7    21.8    23.5   21.7
        write_dict                      31.4    33.3    29.3    29.2    24.7   25.4
        write_strdict                   28.4    29.9    27.5    25.2    23.1   24.5
    
    Stack (or queue) operations:
        list_append_pop                 93.4   112.7    75.4    74.2    50.8   50.6
        deque_append_pop                43.5    57.0    49.4    49.2    42.5   44.2
        deque_append_popleft            43.7    57.3    49.7    49.7    42.8   46.4
    
    Timing loop:
        loop_overhead                    0.5     0.6     0.4     0.3     0.3    0.3
    
    38 bí danh đối với
    Python version                       3.4     3.5     3.6     3.7     3.8    3.9
    --------------                       ---     ---     ---     ---     ---    ---
    
    Variable and attribute read access:
        read_local                       7.1     7.1     5.4     5.1     3.9    3.9
        read_nonlocal                    7.1     8.1     5.8     5.4     4.4    4.5
        read_global                     15.5    19.0    14.3    13.6     7.6    7.8
        read_builtin                    21.1    21.6    18.5    19.0     7.5    7.8
        read_classvar_from_class        25.6    26.5    20.7    19.5    18.4   17.9
        read_classvar_from_instance     22.8    23.5    18.8    17.1    16.4   16.9
        read_instancevar                32.4    33.1    28.0    26.3    25.4   25.3
        read_instancevar_slots          27.8    31.3    20.8    20.8    20.2   20.5
        read_namedtuple                 73.8    57.5    45.0    46.8    18.4   18.7
        read_boundmethod                37.6    37.9    29.6    26.9    27.7   41.1
    
    Variable and attribute write access:
        write_local                      8.7     9.3     5.5     5.3     4.3    4.3
        write_nonlocal                  10.5    11.1     5.6     5.5     4.7    4.8
        write_global                    19.7    21.2    18.0    18.0    15.8   16.7
        write_classvar                  92.9    96.0   104.6   102.1    39.2   39.8
        write_instancevar               44.6    45.8    40.0    38.9    35.5   37.4
        write_instancevar_slots         35.6    36.1    27.3    26.6    25.7   25.8
    
    Data structure read access:
        read_list                       24.2    24.5    20.8    20.8    19.0   19.5
        read_deque                      24.7    25.5    20.2    20.6    19.8   20.2
        read_dict                       24.3    25.7    22.3    23.0    21.0   22.4
        read_strdict                    22.6    24.3    19.5    21.2    18.9   21.5
    
    Data structure write access:
        write_list                      27.1    28.5    22.5    21.6    20.0   20.0
        write_deque                     28.7    30.1    22.7    21.8    23.5   21.7
        write_dict                      31.4    33.3    29.3    29.2    24.7   25.4
        write_strdict                   28.4    29.9    27.5    25.2    23.1   24.5
    
    Stack (or queue) operations:
        list_append_pop                 93.4   112.7    75.4    74.2    50.8   50.6
        deque_append_pop                43.5    57.0    49.4    49.2    42.5   44.2
        deque_append_popleft            43.7    57.3    49.7    49.7    42.8   46.4
    
    Timing loop:
        loop_overhead                    0.5     0.6     0.4     0.3     0.3    0.3
    
    39 và bí danh
    Python version                       3.4     3.5     3.6     3.7     3.8    3.9
    --------------                       ---     ---     ---     ---     ---    ---
    
    Variable and attribute read access:
        read_local                       7.1     7.1     5.4     5.1     3.9    3.9
        read_nonlocal                    7.1     8.1     5.8     5.4     4.4    4.5
        read_global                     15.5    19.0    14.3    13.6     7.6    7.8
        read_builtin                    21.1    21.6    18.5    19.0     7.5    7.8
        read_classvar_from_class        25.6    26.5    20.7    19.5    18.4   17.9
        read_classvar_from_instance     22.8    23.5    18.8    17.1    16.4   16.9
        read_instancevar                32.4    33.1    28.0    26.3    25.4   25.3
        read_instancevar_slots          27.8    31.3    20.8    20.8    20.2   20.5
        read_namedtuple                 73.8    57.5    45.0    46.8    18.4   18.7
        read_boundmethod                37.6    37.9    29.6    26.9    27.7   41.1
    
    Variable and attribute write access:
        write_local                      8.7     9.3     5.5     5.3     4.3    4.3
        write_nonlocal                  10.5    11.1     5.6     5.5     4.7    4.8
        write_global                    19.7    21.2    18.0    18.0    15.8   16.7
        write_classvar                  92.9    96.0   104.6   102.1    39.2   39.8
        write_instancevar               44.6    45.8    40.0    38.9    35.5   37.4
        write_instancevar_slots         35.6    36.1    27.3    26.6    25.7   25.8
    
    Data structure read access:
        read_list                       24.2    24.5    20.8    20.8    19.0   19.5
        read_deque                      24.7    25.5    20.2    20.6    19.8   20.2
        read_dict                       24.3    25.7    22.3    23.0    21.0   22.4
        read_strdict                    22.6    24.3    19.5    21.2    18.9   21.5
    
    Data structure write access:
        write_list                      27.1    28.5    22.5    21.6    20.0   20.0
        write_deque                     28.7    30.1    22.7    21.8    23.5   21.7
        write_dict                      31.4    33.3    29.3    29.2    24.7   25.4
        write_strdict                   28.4    29.9    27.5    25.2    23.1   24.5
    
    Stack (or queue) operations:
        list_append_pop                 93.4   112.7    75.4    74.2    50.8   50.6
        deque_append_pop                43.5    57.0    49.4    49.2    42.5   44.2
        deque_append_popleft            43.7    57.3    49.7    49.7    42.8   46.4
    
    Timing loop:
        loop_overhead                    0.5     0.6     0.4     0.3     0.3    0.3
    
    40 đối với
    Python version                       3.4     3.5     3.6     3.7     3.8    3.9
    --------------                       ---     ---     ---     ---     ---    ---
    
    Variable and attribute read access:
        read_local                       7.1     7.1     5.4     5.1     3.9    3.9
        read_nonlocal                    7.1     8.1     5.8     5.4     4.4    4.5
        read_global                     15.5    19.0    14.3    13.6     7.6    7.8
        read_builtin                    21.1    21.6    18.5    19.0     7.5    7.8
        read_classvar_from_class        25.6    26.5    20.7    19.5    18.4   17.9
        read_classvar_from_instance     22.8    23.5    18.8    17.1    16.4   16.9
        read_instancevar                32.4    33.1    28.0    26.3    25.4   25.3
        read_instancevar_slots          27.8    31.3    20.8    20.8    20.2   20.5
        read_namedtuple                 73.8    57.5    45.0    46.8    18.4   18.7
        read_boundmethod                37.6    37.9    29.6    26.9    27.7   41.1
    
    Variable and attribute write access:
        write_local                      8.7     9.3     5.5     5.3     4.3    4.3
        write_nonlocal                  10.5    11.1     5.6     5.5     4.7    4.8
        write_global                    19.7    21.2    18.0    18.0    15.8   16.7
        write_classvar                  92.9    96.0   104.6   102.1    39.2   39.8
        write_instancevar               44.6    45.8    40.0    38.9    35.5   37.4
        write_instancevar_slots         35.6    36.1    27.3    26.6    25.7   25.8
    
    Data structure read access:
        read_list                       24.2    24.5    20.8    20.8    19.0   19.5
        read_deque                      24.7    25.5    20.2    20.6    19.8   20.2
        read_dict                       24.3    25.7    22.3    23.0    21.0   22.4
        read_strdict                    22.6    24.3    19.5    21.2    18.9   21.5
    
    Data structure write access:
        write_list                      27.1    28.5    22.5    21.6    20.0   20.0
        write_deque                     28.7    30.1    22.7    21.8    23.5   21.7
        write_dict                      31.4    33.3    29.3    29.2    24.7   25.4
        write_strdict                   28.4    29.9    27.5    25.2    23.1   24.5
    
    Stack (or queue) operations:
        list_append_pop                 93.4   112.7    75.4    74.2    50.8   50.6
        deque_append_pop                43.5    57.0    49.4    49.2    42.5   44.2
        deque_append_popleft            43.7    57.3    49.7    49.7    42.8   46.4
    
    Timing loop:
        loop_overhead                    0.5     0.6     0.4     0.3     0.3    0.3
    
    41 đã bị xóa. Họ đã không được chấp nhận kể từ Python 3.7. (Được đóng góp bởi Victor Stinner trong BPO-37320.)

  • Phương pháp

    Python version                       3.4     3.5     3.6     3.7     3.8    3.9
    --------------                       ---     ---     ---     ---     ---    ---
    
    Variable and attribute read access:
        read_local                       7.1     7.1     5.4     5.1     3.9    3.9
        read_nonlocal                    7.1     8.1     5.8     5.4     4.4    4.5
        read_global                     15.5    19.0    14.3    13.6     7.6    7.8
        read_builtin                    21.1    21.6    18.5    19.0     7.5    7.8
        read_classvar_from_class        25.6    26.5    20.7    19.5    18.4   17.9
        read_classvar_from_instance     22.8    23.5    18.8    17.1    16.4   16.9
        read_instancevar                32.4    33.1    28.0    26.3    25.4   25.3
        read_instancevar_slots          27.8    31.3    20.8    20.8    20.2   20.5
        read_namedtuple                 73.8    57.5    45.0    46.8    18.4   18.7
        read_boundmethod                37.6    37.9    29.6    26.9    27.7   41.1
    
    Variable and attribute write access:
        write_local                      8.7     9.3     5.5     5.3     4.3    4.3
        write_nonlocal                  10.5    11.1     5.6     5.5     4.7    4.8
        write_global                    19.7    21.2    18.0    18.0    15.8   16.7
        write_classvar                  92.9    96.0   104.6   102.1    39.2   39.8
        write_instancevar               44.6    45.8    40.0    38.9    35.5   37.4
        write_instancevar_slots         35.6    36.1    27.3    26.6    25.7   25.8
    
    Data structure read access:
        read_list                       24.2    24.5    20.8    20.8    19.0   19.5
        read_deque                      24.7    25.5    20.2    20.6    19.8   20.2
        read_dict                       24.3    25.7    22.3    23.0    21.0   22.4
        read_strdict                    22.6    24.3    19.5    21.2    18.9   21.5
    
    Data structure write access:
        write_list                      27.1    28.5    22.5    21.6    20.0   20.0
        write_deque                     28.7    30.1    22.7    21.8    23.5   21.7
        write_dict                      31.4    33.3    29.3    29.2    24.7   25.4
        write_strdict                   28.4    29.9    27.5    25.2    23.1   24.5
    
    Stack (or queue) operations:
        list_append_pop                 93.4   112.7    75.4    74.2    50.8   50.6
        deque_append_pop                43.5    57.0    49.4    49.2    42.5   44.2
        deque_append_popleft            43.7    57.3    49.7    49.7    42.8   46.4
    
    Timing loop:
        loop_overhead                    0.5     0.6     0.4     0.3     0.3    0.3
    
    42 của
    Python version                       3.4     3.5     3.6     3.7     3.8    3.9
    --------------                       ---     ---     ---     ---     ---    ---
    
    Variable and attribute read access:
        read_local                       7.1     7.1     5.4     5.1     3.9    3.9
        read_nonlocal                    7.1     8.1     5.8     5.4     4.4    4.5
        read_global                     15.5    19.0    14.3    13.6     7.6    7.8
        read_builtin                    21.1    21.6    18.5    19.0     7.5    7.8
        read_classvar_from_class        25.6    26.5    20.7    19.5    18.4   17.9
        read_classvar_from_instance     22.8    23.5    18.8    17.1    16.4   16.9
        read_instancevar                32.4    33.1    28.0    26.3    25.4   25.3
        read_instancevar_slots          27.8    31.3    20.8    20.8    20.2   20.5
        read_namedtuple                 73.8    57.5    45.0    46.8    18.4   18.7
        read_boundmethod                37.6    37.9    29.6    26.9    27.7   41.1
    
    Variable and attribute write access:
        write_local                      8.7     9.3     5.5     5.3     4.3    4.3
        write_nonlocal                  10.5    11.1     5.6     5.5     4.7    4.8
        write_global                    19.7    21.2    18.0    18.0    15.8   16.7
        write_classvar                  92.9    96.0   104.6   102.1    39.2   39.8
        write_instancevar               44.6    45.8    40.0    38.9    35.5   37.4
        write_instancevar_slots         35.6    36.1    27.3    26.6    25.7   25.8
    
    Data structure read access:
        read_list                       24.2    24.5    20.8    20.8    19.0   19.5
        read_deque                      24.7    25.5    20.2    20.6    19.8   20.2
        read_dict                       24.3    25.7    22.3    23.0    21.0   22.4
        read_strdict                    22.6    24.3    19.5    21.2    18.9   21.5
    
    Data structure write access:
        write_list                      27.1    28.5    22.5    21.6    20.0   20.0
        write_deque                     28.7    30.1    22.7    21.8    23.5   21.7
        write_dict                      31.4    33.3    29.3    29.2    24.7   25.4
        write_strdict                   28.4    29.9    27.5    25.2    23.1   24.5
    
    Stack (or queue) operations:
        list_append_pop                 93.4   112.7    75.4    74.2    50.8   50.6
        deque_append_pop                43.5    57.0    49.4    49.2    42.5   44.2
        deque_append_popleft            43.7    57.3    49.7    49.7    42.8   46.4
    
    Timing loop:
        loop_overhead                    0.5     0.6     0.4     0.3     0.3    0.3
    
    43 đã bị loại bỏ. Nó đã không được chấp nhận kể từ Python 3,8. Sử dụng
    Python version                       3.4     3.5     3.6     3.7     3.8    3.9
    --------------                       ---     ---     ---     ---     ---    ---
    
    Variable and attribute read access:
        read_local                       7.1     7.1     5.4     5.1     3.9    3.9
        read_nonlocal                    7.1     8.1     5.8     5.4     4.4    4.5
        read_global                     15.5    19.0    14.3    13.6     7.6    7.8
        read_builtin                    21.1    21.6    18.5    19.0     7.5    7.8
        read_classvar_from_class        25.6    26.5    20.7    19.5    18.4   17.9
        read_classvar_from_instance     22.8    23.5    18.8    17.1    16.4   16.9
        read_instancevar                32.4    33.1    28.0    26.3    25.4   25.3
        read_instancevar_slots          27.8    31.3    20.8    20.8    20.2   20.5
        read_namedtuple                 73.8    57.5    45.0    46.8    18.4   18.7
        read_boundmethod                37.6    37.9    29.6    26.9    27.7   41.1
    
    Variable and attribute write access:
        write_local                      8.7     9.3     5.5     5.3     4.3    4.3
        write_nonlocal                  10.5    11.1     5.6     5.5     4.7    4.8
        write_global                    19.7    21.2    18.0    18.0    15.8   16.7
        write_classvar                  92.9    96.0   104.6   102.1    39.2   39.8
        write_instancevar               44.6    45.8    40.0    38.9    35.5   37.4
        write_instancevar_slots         35.6    36.1    27.3    26.6    25.7   25.8
    
    Data structure read access:
        read_list                       24.2    24.5    20.8    20.8    19.0   19.5
        read_deque                      24.7    25.5    20.2    20.6    19.8   20.2
        read_dict                       24.3    25.7    22.3    23.0    21.0   22.4
        read_strdict                    22.6    24.3    19.5    21.2    18.9   21.5
    
    Data structure write access:
        write_list                      27.1    28.5    22.5    21.6    20.0   20.0
        write_deque                     28.7    30.1    22.7    21.8    23.5   21.7
        write_dict                      31.4    33.3    29.3    29.2    24.7   25.4
        write_strdict                   28.4    29.9    27.5    25.2    23.1   24.5
    
    Stack (or queue) operations:
        list_append_pop                 93.4   112.7    75.4    74.2    50.8   50.6
        deque_append_pop                43.5    57.0    49.4    49.2    42.5   44.2
        deque_append_popleft            43.7    57.3    49.7    49.7    42.8   46.4
    
    Timing loop:
        loop_overhead                    0.5     0.6     0.4     0.3     0.3    0.3
    
    44 thay thế. (Được đóng góp bởi Dong-hee NA trong BPO-37804.)

  • Phương pháp

    Python version                       3.4     3.5     3.6     3.7     3.8    3.9
    --------------                       ---     ---     ---     ---     ---    ---
    
    Variable and attribute read access:
        read_local                       7.1     7.1     5.4     5.1     3.9    3.9
        read_nonlocal                    7.1     8.1     5.8     5.4     4.4    4.5
        read_global                     15.5    19.0    14.3    13.6     7.6    7.8
        read_builtin                    21.1    21.6    18.5    19.0     7.5    7.8
        read_classvar_from_class        25.6    26.5    20.7    19.5    18.4   17.9
        read_classvar_from_instance     22.8    23.5    18.8    17.1    16.4   16.9
        read_instancevar                32.4    33.1    28.0    26.3    25.4   25.3
        read_instancevar_slots          27.8    31.3    20.8    20.8    20.2   20.5
        read_namedtuple                 73.8    57.5    45.0    46.8    18.4   18.7
        read_boundmethod                37.6    37.9    29.6    26.9    27.7   41.1
    
    Variable and attribute write access:
        write_local                      8.7     9.3     5.5     5.3     4.3    4.3
        write_nonlocal                  10.5    11.1     5.6     5.5     4.7    4.8
        write_global                    19.7    21.2    18.0    18.0    15.8   16.7
        write_classvar                  92.9    96.0   104.6   102.1    39.2   39.8
        write_instancevar               44.6    45.8    40.0    38.9    35.5   37.4
        write_instancevar_slots         35.6    36.1    27.3    26.6    25.7   25.8
    
    Data structure read access:
        read_list                       24.2    24.5    20.8    20.8    19.0   19.5
        read_deque                      24.7    25.5    20.2    20.6    19.8   20.2
        read_dict                       24.3    25.7    22.3    23.0    21.0   22.4
        read_strdict                    22.6    24.3    19.5    21.2    18.9   21.5
    
    Data structure write access:
        write_list                      27.1    28.5    22.5    21.6    20.0   20.0
        write_deque                     28.7    30.1    22.7    21.8    23.5   21.7
        write_dict                      31.4    33.3    29.3    29.2    24.7   25.4
        write_strdict                   28.4    29.9    27.5    25.2    23.1   24.5
    
    Stack (or queue) operations:
        list_append_pop                 93.4   112.7    75.4    74.2    50.8   50.6
        deque_append_pop                43.5    57.0    49.4    49.2    42.5   44.2
        deque_append_popleft            43.7    57.3    49.7    49.7    42.8   46.4
    
    Timing loop:
        loop_overhead                    0.5     0.6     0.4     0.3     0.3    0.3
    
    45 và
    Python version                       3.4     3.5     3.6     3.7     3.8    3.9
    --------------                       ---     ---     ---     ---     ---    ---
    
    Variable and attribute read access:
        read_local                       7.1     7.1     5.4     5.1     3.9    3.9
        read_nonlocal                    7.1     8.1     5.8     5.4     4.4    4.5
        read_global                     15.5    19.0    14.3    13.6     7.6    7.8
        read_builtin                    21.1    21.6    18.5    19.0     7.5    7.8
        read_classvar_from_class        25.6    26.5    20.7    19.5    18.4   17.9
        read_classvar_from_instance     22.8    23.5    18.8    17.1    16.4   16.9
        read_instancevar                32.4    33.1    28.0    26.3    25.4   25.3
        read_instancevar_slots          27.8    31.3    20.8    20.8    20.2   20.5
        read_namedtuple                 73.8    57.5    45.0    46.8    18.4   18.7
        read_boundmethod                37.6    37.9    29.6    26.9    27.7   41.1
    
    Variable and attribute write access:
        write_local                      8.7     9.3     5.5     5.3     4.3    4.3
        write_nonlocal                  10.5    11.1     5.6     5.5     4.7    4.8
        write_global                    19.7    21.2    18.0    18.0    15.8   16.7
        write_classvar                  92.9    96.0   104.6   102.1    39.2   39.8
        write_instancevar               44.6    45.8    40.0    38.9    35.5   37.4
        write_instancevar_slots         35.6    36.1    27.3    26.6    25.7   25.8
    
    Data structure read access:
        read_list                       24.2    24.5    20.8    20.8    19.0   19.5
        read_deque                      24.7    25.5    20.2    20.6    19.8   20.2
        read_dict                       24.3    25.7    22.3    23.0    21.0   22.4
        read_strdict                    22.6    24.3    19.5    21.2    18.9   21.5
    
    Data structure write access:
        write_list                      27.1    28.5    22.5    21.6    20.0   20.0
        write_deque                     28.7    30.1    22.7    21.8    23.5   21.7
        write_dict                      31.4    33.3    29.3    29.2    24.7   25.4
        write_strdict                   28.4    29.9    27.5    25.2    23.1   24.5
    
    Stack (or queue) operations:
        list_append_pop                 93.4   112.7    75.4    74.2    50.8   50.6
        deque_append_pop                43.5    57.0    49.4    49.2    42.5   44.2
        deque_append_popleft            43.7    57.3    49.7    49.7    42.8   46.4
    
    Timing loop:
        loop_overhead                    0.5     0.6     0.4     0.3     0.3    0.3
    
    46 của các lớp
    Python version                       3.4     3.5     3.6     3.7     3.8    3.9
    --------------                       ---     ---     ---     ---     ---    ---
    
    Variable and attribute read access:
        read_local                       7.1     7.1     5.4     5.1     3.9    3.9
        read_nonlocal                    7.1     8.1     5.8     5.4     4.4    4.5
        read_global                     15.5    19.0    14.3    13.6     7.6    7.8
        read_builtin                    21.1    21.6    18.5    19.0     7.5    7.8
        read_classvar_from_class        25.6    26.5    20.7    19.5    18.4   17.9
        read_classvar_from_instance     22.8    23.5    18.8    17.1    16.4   16.9
        read_instancevar                32.4    33.1    28.0    26.3    25.4   25.3
        read_instancevar_slots          27.8    31.3    20.8    20.8    20.2   20.5
        read_namedtuple                 73.8    57.5    45.0    46.8    18.4   18.7
        read_boundmethod                37.6    37.9    29.6    26.9    27.7   41.1
    
    Variable and attribute write access:
        write_local                      8.7     9.3     5.5     5.3     4.3    4.3
        write_nonlocal                  10.5    11.1     5.6     5.5     4.7    4.8
        write_global                    19.7    21.2    18.0    18.0    15.8   16.7
        write_classvar                  92.9    96.0   104.6   102.1    39.2   39.8
        write_instancevar               44.6    45.8    40.0    38.9    35.5   37.4
        write_instancevar_slots         35.6    36.1    27.3    26.6    25.7   25.8
    
    Data structure read access:
        read_list                       24.2    24.5    20.8    20.8    19.0   19.5
        read_deque                      24.7    25.5    20.2    20.6    19.8   20.2
        read_dict                       24.3    25.7    22.3    23.0    21.0   22.4
        read_strdict                    22.6    24.3    19.5    21.2    18.9   21.5
    
    Data structure write access:
        write_list                      27.1    28.5    22.5    21.6    20.0   20.0
        write_deque                     28.7    30.1    22.7    21.8    23.5   21.7
        write_dict                      31.4    33.3    29.3    29.2    24.7   25.4
        write_strdict                   28.4    29.9    27.5    25.2    23.1   24.5
    
    Stack (or queue) operations:
        list_append_pop                 93.4   112.7    75.4    74.2    50.8   50.6
        deque_append_pop                43.5    57.0    49.4    49.2    42.5   44.2
        deque_append_popleft            43.7    57.3    49.7    49.7    42.8   46.4
    
    Timing loop:
        loop_overhead                    0.5     0.6     0.4     0.3     0.3    0.3
    
    47 và
    Python version                       3.4     3.5     3.6     3.7     3.8    3.9
    --------------                       ---     ---     ---     ---     ---    ---
    
    Variable and attribute read access:
        read_local                       7.1     7.1     5.4     5.1     3.9    3.9
        read_nonlocal                    7.1     8.1     5.8     5.4     4.4    4.5
        read_global                     15.5    19.0    14.3    13.6     7.6    7.8
        read_builtin                    21.1    21.6    18.5    19.0     7.5    7.8
        read_classvar_from_class        25.6    26.5    20.7    19.5    18.4   17.9
        read_classvar_from_instance     22.8    23.5    18.8    17.1    16.4   16.9
        read_instancevar                32.4    33.1    28.0    26.3    25.4   25.3
        read_instancevar_slots          27.8    31.3    20.8    20.8    20.2   20.5
        read_namedtuple                 73.8    57.5    45.0    46.8    18.4   18.7
        read_boundmethod                37.6    37.9    29.6    26.9    27.7   41.1
    
    Variable and attribute write access:
        write_local                      8.7     9.3     5.5     5.3     4.3    4.3
        write_nonlocal                  10.5    11.1     5.6     5.5     4.7    4.8
        write_global                    19.7    21.2    18.0    18.0    15.8   16.7
        write_classvar                  92.9    96.0   104.6   102.1    39.2   39.8
        write_instancevar               44.6    45.8    40.0    38.9    35.5   37.4
        write_instancevar_slots         35.6    36.1    27.3    26.6    25.7   25.8
    
    Data structure read access:
        read_list                       24.2    24.5    20.8    20.8    19.0   19.5
        read_deque                      24.7    25.5    20.2    20.6    19.8   20.2
        read_dict                       24.3    25.7    22.3    23.0    21.0   22.4
        read_strdict                    22.6    24.3    19.5    21.2    18.9   21.5
    
    Data structure write access:
        write_list                      27.1    28.5    22.5    21.6    20.0   20.0
        write_deque                     28.7    30.1    22.7    21.8    23.5   21.7
        write_dict                      31.4    33.3    29.3    29.2    24.7   25.4
        write_strdict                   28.4    29.9    27.5    25.2    23.1   24.5
    
    Stack (or queue) operations:
        list_append_pop                 93.4   112.7    75.4    74.2    50.8   50.6
        deque_append_pop                43.5    57.0    49.4    49.2    42.5   44.2
        deque_append_popleft            43.7    57.3    49.7    49.7    42.8   46.4
    
    Timing loop:
        loop_overhead                    0.5     0.6     0.4     0.3     0.3    0.3
    
    48 trong mô -đun
    Python version                       3.4     3.5     3.6     3.7     3.8    3.9
    --------------                       ---     ---     ---     ---     ---    ---
    
    Variable and attribute read access:
        read_local                       7.1     7.1     5.4     5.1     3.9    3.9
        read_nonlocal                    7.1     8.1     5.8     5.4     4.4    4.5
        read_global                     15.5    19.0    14.3    13.6     7.6    7.8
        read_builtin                    21.1    21.6    18.5    19.0     7.5    7.8
        read_classvar_from_class        25.6    26.5    20.7    19.5    18.4   17.9
        read_classvar_from_instance     22.8    23.5    18.8    17.1    16.4   16.9
        read_instancevar                32.4    33.1    28.0    26.3    25.4   25.3
        read_instancevar_slots          27.8    31.3    20.8    20.8    20.2   20.5
        read_namedtuple                 73.8    57.5    45.0    46.8    18.4   18.7
        read_boundmethod                37.6    37.9    29.6    26.9    27.7   41.1
    
    Variable and attribute write access:
        write_local                      8.7     9.3     5.5     5.3     4.3    4.3
        write_nonlocal                  10.5    11.1     5.6     5.5     4.7    4.8
        write_global                    19.7    21.2    18.0    18.0    15.8   16.7
        write_classvar                  92.9    96.0   104.6   102.1    39.2   39.8
        write_instancevar               44.6    45.8    40.0    38.9    35.5   37.4
        write_instancevar_slots         35.6    36.1    27.3    26.6    25.7   25.8
    
    Data structure read access:
        read_list                       24.2    24.5    20.8    20.8    19.0   19.5
        read_deque                      24.7    25.5    20.2    20.6    19.8   20.2
        read_dict                       24.3    25.7    22.3    23.0    21.0   22.4
        read_strdict                    22.6    24.3    19.5    21.2    18.9   21.5
    
    Data structure write access:
        write_list                      27.1    28.5    22.5    21.6    20.0   20.0
        write_deque                     28.7    30.1    22.7    21.8    23.5   21.7
        write_dict                      31.4    33.3    29.3    29.2    24.7   25.4
        write_strdict                   28.4    29.9    27.5    25.2    23.1   24.5
    
    Stack (or queue) operations:
        list_append_pop                 93.4   112.7    75.4    74.2    50.8   50.6
        deque_append_pop                43.5    57.0    49.4    49.2    42.5   44.2
        deque_append_popleft            43.7    57.3    49.7    49.7    42.8   46.4
    
    Timing loop:
        loop_overhead                    0.5     0.6     0.4     0.3     0.3    0.3
    
    47 đã bị xóa. Họ đã không được dùng trong Python 3.2. Sử dụng
    Python version                       3.4     3.5     3.6     3.7     3.8    3.9
    --------------                       ---     ---     ---     ---     ---    ---
    
    Variable and attribute read access:
        read_local                       7.1     7.1     5.4     5.1     3.9    3.9
        read_nonlocal                    7.1     8.1     5.8     5.4     4.4    4.5
        read_global                     15.5    19.0    14.3    13.6     7.6    7.8
        read_builtin                    21.1    21.6    18.5    19.0     7.5    7.8
        read_classvar_from_class        25.6    26.5    20.7    19.5    18.4   17.9
        read_classvar_from_instance     22.8    23.5    18.8    17.1    16.4   16.9
        read_instancevar                32.4    33.1    28.0    26.3    25.4   25.3
        read_instancevar_slots          27.8    31.3    20.8    20.8    20.2   20.5
        read_namedtuple                 73.8    57.5    45.0    46.8    18.4   18.7
        read_boundmethod                37.6    37.9    29.6    26.9    27.7   41.1
    
    Variable and attribute write access:
        write_local                      8.7     9.3     5.5     5.3     4.3    4.3
        write_nonlocal                  10.5    11.1     5.6     5.5     4.7    4.8
        write_global                    19.7    21.2    18.0    18.0    15.8   16.7
        write_classvar                  92.9    96.0   104.6   102.1    39.2   39.8
        write_instancevar               44.6    45.8    40.0    38.9    35.5   37.4
        write_instancevar_slots         35.6    36.1    27.3    26.6    25.7   25.8
    
    Data structure read access:
        read_list                       24.2    24.5    20.8    20.8    19.0   19.5
        read_deque                      24.7    25.5    20.2    20.6    19.8   20.2
        read_dict                       24.3    25.7    22.3    23.0    21.0   22.4
        read_strdict                    22.6    24.3    19.5    21.2    18.9   21.5
    
    Data structure write access:
        write_list                      27.1    28.5    22.5    21.6    20.0   20.0
        write_deque                     28.7    30.1    22.7    21.8    23.5   21.7
        write_dict                      31.4    33.3    29.3    29.2    24.7   25.4
        write_strdict                   28.4    29.9    27.5    25.2    23.1   24.5
    
    Stack (or queue) operations:
        list_append_pop                 93.4   112.7    75.4    74.2    50.8   50.6
        deque_append_pop                43.5    57.0    49.4    49.2    42.5   44.2
        deque_append_popleft            43.7    57.3    49.7    49.7    42.8   46.4
    
    Timing loop:
        loop_overhead                    0.5     0.6     0.4     0.3     0.3    0.3
    
    50 hoặc
    Python version                       3.4     3.5     3.6     3.7     3.8    3.9
    --------------                       ---     ---     ---     ---     ---    ---
    
    Variable and attribute read access:
        read_local                       7.1     7.1     5.4     5.1     3.9    3.9
        read_nonlocal                    7.1     8.1     5.8     5.4     4.4    4.5
        read_global                     15.5    19.0    14.3    13.6     7.6    7.8
        read_builtin                    21.1    21.6    18.5    19.0     7.5    7.8
        read_classvar_from_class        25.6    26.5    20.7    19.5    18.4   17.9
        read_classvar_from_instance     22.8    23.5    18.8    17.1    16.4   16.9
        read_instancevar                32.4    33.1    28.0    26.3    25.4   25.3
        read_instancevar_slots          27.8    31.3    20.8    20.8    20.2   20.5
        read_namedtuple                 73.8    57.5    45.0    46.8    18.4   18.7
        read_boundmethod                37.6    37.9    29.6    26.9    27.7   41.1
    
    Variable and attribute write access:
        write_local                      8.7     9.3     5.5     5.3     4.3    4.3
        write_nonlocal                  10.5    11.1     5.6     5.5     4.7    4.8
        write_global                    19.7    21.2    18.0    18.0    15.8   16.7
        write_classvar                  92.9    96.0   104.6   102.1    39.2   39.8
        write_instancevar               44.6    45.8    40.0    38.9    35.5   37.4
        write_instancevar_slots         35.6    36.1    27.3    26.6    25.7   25.8
    
    Data structure read access:
        read_list                       24.2    24.5    20.8    20.8    19.0   19.5
        read_deque                      24.7    25.5    20.2    20.6    19.8   20.2
        read_dict                       24.3    25.7    22.3    23.0    21.0   22.4
        read_strdict                    22.6    24.3    19.5    21.2    18.9   21.5
    
    Data structure write access:
        write_list                      27.1    28.5    22.5    21.6    20.0   20.0
        write_deque                     28.7    30.1    22.7    21.8    23.5   21.7
        write_dict                      31.4    33.3    29.3    29.2    24.7   25.4
        write_strdict                   28.4    29.9    27.5    25.2    23.1   24.5
    
    Stack (or queue) operations:
        list_append_pop                 93.4   112.7    75.4    74.2    50.8   50.6
        deque_append_pop                43.5    57.0    49.4    49.2    42.5   44.2
        deque_append_popleft            43.7    57.3    49.7    49.7    42.8   46.4
    
    Timing loop:
        loop_overhead                    0.5     0.6     0.4     0.3     0.3    0.3
    
    51 thay vì
    Python version                       3.4     3.5     3.6     3.7     3.8    3.9
    --------------                       ---     ---     ---     ---     ---    ---
    
    Variable and attribute read access:
        read_local                       7.1     7.1     5.4     5.1     3.9    3.9
        read_nonlocal                    7.1     8.1     5.8     5.4     4.4    4.5
        read_global                     15.5    19.0    14.3    13.6     7.6    7.8
        read_builtin                    21.1    21.6    18.5    19.0     7.5    7.8
        read_classvar_from_class        25.6    26.5    20.7    19.5    18.4   17.9
        read_classvar_from_instance     22.8    23.5    18.8    17.1    16.4   16.9
        read_instancevar                32.4    33.1    28.0    26.3    25.4   25.3
        read_instancevar_slots          27.8    31.3    20.8    20.8    20.2   20.5
        read_namedtuple                 73.8    57.5    45.0    46.8    18.4   18.7
        read_boundmethod                37.6    37.9    29.6    26.9    27.7   41.1
    
    Variable and attribute write access:
        write_local                      8.7     9.3     5.5     5.3     4.3    4.3
        write_nonlocal                  10.5    11.1     5.6     5.5     4.7    4.8
        write_global                    19.7    21.2    18.0    18.0    15.8   16.7
        write_classvar                  92.9    96.0   104.6   102.1    39.2   39.8
        write_instancevar               44.6    45.8    40.0    38.9    35.5   37.4
        write_instancevar_slots         35.6    36.1    27.3    26.6    25.7   25.8
    
    Data structure read access:
        read_list                       24.2    24.5    20.8    20.8    19.0   19.5
        read_deque                      24.7    25.5    20.2    20.6    19.8   20.2
        read_dict                       24.3    25.7    22.3    23.0    21.0   22.4
        read_strdict                    22.6    24.3    19.5    21.2    18.9   21.5
    
    Data structure write access:
        write_list                      27.1    28.5    22.5    21.6    20.0   20.0
        write_deque                     28.7    30.1    22.7    21.8    23.5   21.7
        write_dict                      31.4    33.3    29.3    29.2    24.7   25.4
        write_strdict                   28.4    29.9    27.5    25.2    23.1   24.5
    
    Stack (or queue) operations:
        list_append_pop                 93.4   112.7    75.4    74.2    50.8   50.6
        deque_append_pop                43.5    57.0    49.4    49.2    42.5   44.2
        deque_append_popleft            43.7    57.3    49.7    49.7    42.8   46.4
    
    Timing loop:
        loop_overhead                    0.5     0.6     0.4     0.3     0.3    0.3
    
    52 và
    Python version                       3.4     3.5     3.6     3.7     3.8    3.9
    --------------                       ---     ---     ---     ---     ---    ---
    
    Variable and attribute read access:
        read_local                       7.1     7.1     5.4     5.1     3.9    3.9
        read_nonlocal                    7.1     8.1     5.8     5.4     4.4    4.5
        read_global                     15.5    19.0    14.3    13.6     7.6    7.8
        read_builtin                    21.1    21.6    18.5    19.0     7.5    7.8
        read_classvar_from_class        25.6    26.5    20.7    19.5    18.4   17.9
        read_classvar_from_instance     22.8    23.5    18.8    17.1    16.4   16.9
        read_instancevar                32.4    33.1    28.0    26.3    25.4   25.3
        read_instancevar_slots          27.8    31.3    20.8    20.8    20.2   20.5
        read_namedtuple                 73.8    57.5    45.0    46.8    18.4   18.7
        read_boundmethod                37.6    37.9    29.6    26.9    27.7   41.1
    
    Variable and attribute write access:
        write_local                      8.7     9.3     5.5     5.3     4.3    4.3
        write_nonlocal                  10.5    11.1     5.6     5.5     4.7    4.8
        write_global                    19.7    21.2    18.0    18.0    15.8   16.7
        write_classvar                  92.9    96.0   104.6   102.1    39.2   39.8
        write_instancevar               44.6    45.8    40.0    38.9    35.5   37.4
        write_instancevar_slots         35.6    36.1    27.3    26.6    25.7   25.8
    
    Data structure read access:
        read_list                       24.2    24.5    20.8    20.8    19.0   19.5
        read_deque                      24.7    25.5    20.2    20.6    19.8   20.2
        read_dict                       24.3    25.7    22.3    23.0    21.0   22.4
        read_strdict                    22.6    24.3    19.5    21.2    18.9   21.5
    
    Data structure write access:
        write_list                      27.1    28.5    22.5    21.6    20.0   20.0
        write_deque                     28.7    30.1    22.7    21.8    23.5   21.7
        write_dict                      31.4    33.3    29.3    29.2    24.7   25.4
        write_strdict                   28.4    29.9    27.5    25.2    23.1   24.5
    
    Stack (or queue) operations:
        list_append_pop                 93.4   112.7    75.4    74.2    50.8   50.6
        deque_append_pop                43.5    57.0    49.4    49.2    42.5   44.2
        deque_append_popleft            43.7    57.3    49.7    49.7    42.8   46.4
    
    Timing loop:
        loop_overhead                    0.5     0.6     0.4     0.3     0.3    0.3
    
    53 hoặc
    Python version                       3.4     3.5     3.6     3.7     3.8    3.9
    --------------                       ---     ---     ---     ---     ---    ---
    
    Variable and attribute read access:
        read_local                       7.1     7.1     5.4     5.1     3.9    3.9
        read_nonlocal                    7.1     8.1     5.8     5.4     4.4    4.5
        read_global                     15.5    19.0    14.3    13.6     7.6    7.8
        read_builtin                    21.1    21.6    18.5    19.0     7.5    7.8
        read_classvar_from_class        25.6    26.5    20.7    19.5    18.4   17.9
        read_classvar_from_instance     22.8    23.5    18.8    17.1    16.4   16.9
        read_instancevar                32.4    33.1    28.0    26.3    25.4   25.3
        read_instancevar_slots          27.8    31.3    20.8    20.8    20.2   20.5
        read_namedtuple                 73.8    57.5    45.0    46.8    18.4   18.7
        read_boundmethod                37.6    37.9    29.6    26.9    27.7   41.1
    
    Variable and attribute write access:
        write_local                      8.7     9.3     5.5     5.3     4.3    4.3
        write_nonlocal                  10.5    11.1     5.6     5.5     4.7    4.8
        write_global                    19.7    21.2    18.0    18.0    15.8   16.7
        write_classvar                  92.9    96.0   104.6   102.1    39.2   39.8
        write_instancevar               44.6    45.8    40.0    38.9    35.5   37.4
        write_instancevar_slots         35.6    36.1    27.3    26.6    25.7   25.8
    
    Data structure read access:
        read_list                       24.2    24.5    20.8    20.8    19.0   19.5
        read_deque                      24.7    25.5    20.2    20.6    19.8   20.2
        read_dict                       24.3    25.7    22.3    23.0    21.0   22.4
        read_strdict                    22.6    24.3    19.5    21.2    18.9   21.5
    
    Data structure write access:
        write_list                      27.1    28.5    22.5    21.6    20.0   20.0
        write_deque                     28.7    30.1    22.7    21.8    23.5   21.7
        write_dict                      31.4    33.3    29.3    29.2    24.7   25.4
        write_strdict                   28.4    29.9    27.5    25.2    23.1   24.5
    
    Stack (or queue) operations:
        list_append_pop                 93.4   112.7    75.4    74.2    50.8   50.6
        deque_append_pop                43.5    57.0    49.4    49.2    42.5   44.2
        deque_append_popleft            43.7    57.3    49.7    49.7    42.8   46.4
    
    Timing loop:
        loop_overhead                    0.5     0.6     0.4     0.3     0.3    0.3
    
    54 thay vì
    Python version                       3.4     3.5     3.6     3.7     3.8    3.9
    --------------                       ---     ---     ---     ---     ---    ---
    
    Variable and attribute read access:
        read_local                       7.1     7.1     5.4     5.1     3.9    3.9
        read_nonlocal                    7.1     8.1     5.8     5.4     4.4    4.5
        read_global                     15.5    19.0    14.3    13.6     7.6    7.8
        read_builtin                    21.1    21.6    18.5    19.0     7.5    7.8
        read_classvar_from_class        25.6    26.5    20.7    19.5    18.4   17.9
        read_classvar_from_instance     22.8    23.5    18.8    17.1    16.4   16.9
        read_instancevar                32.4    33.1    28.0    26.3    25.4   25.3
        read_instancevar_slots          27.8    31.3    20.8    20.8    20.2   20.5
        read_namedtuple                 73.8    57.5    45.0    46.8    18.4   18.7
        read_boundmethod                37.6    37.9    29.6    26.9    27.7   41.1
    
    Variable and attribute write access:
        write_local                      8.7     9.3     5.5     5.3     4.3    4.3
        write_nonlocal                  10.5    11.1     5.6     5.5     4.7    4.8
        write_global                    19.7    21.2    18.0    18.0    15.8   16.7
        write_classvar                  92.9    96.0   104.6   102.1    39.2   39.8
        write_instancevar               44.6    45.8    40.0    38.9    35.5   37.4
        write_instancevar_slots         35.6    36.1    27.3    26.6    25.7   25.8
    
    Data structure read access:
        read_list                       24.2    24.5    20.8    20.8    19.0   19.5
        read_deque                      24.7    25.5    20.2    20.6    19.8   20.2
        read_dict                       24.3    25.7    22.3    23.0    21.0   22.4
        read_strdict                    22.6    24.3    19.5    21.2    18.9   21.5
    
    Data structure write access:
        write_list                      27.1    28.5    22.5    21.6    20.0   20.0
        write_deque                     28.7    30.1    22.7    21.8    23.5   21.7
        write_dict                      31.4    33.3    29.3    29.2    24.7   25.4
        write_strdict                   28.4    29.9    27.5    25.2    23.1   24.5
    
    Stack (or queue) operations:
        list_append_pop                 93.4   112.7    75.4    74.2    50.8   50.6
        deque_append_pop                43.5    57.0    49.4    49.2    42.5   44.2
        deque_append_popleft            43.7    57.3    49.7    49.7    42.8   46.4
    
    Timing loop:
        loop_overhead                    0.5     0.6     0.4     0.3     0.3    0.3
    
    55. (Được đóng góp bởi Serhiy Storchaka trong BPO-36543.)

  • API

    Python version                       3.4     3.5     3.6     3.7     3.8    3.9
    --------------                       ---     ---     ---     ---     ---    ---
    
    Variable and attribute read access:
        read_local                       7.1     7.1     5.4     5.1     3.9    3.9
        read_nonlocal                    7.1     8.1     5.8     5.4     4.4    4.5
        read_global                     15.5    19.0    14.3    13.6     7.6    7.8
        read_builtin                    21.1    21.6    18.5    19.0     7.5    7.8
        read_classvar_from_class        25.6    26.5    20.7    19.5    18.4   17.9
        read_classvar_from_instance     22.8    23.5    18.8    17.1    16.4   16.9
        read_instancevar                32.4    33.1    28.0    26.3    25.4   25.3
        read_instancevar_slots          27.8    31.3    20.8    20.8    20.2   20.5
        read_namedtuple                 73.8    57.5    45.0    46.8    18.4   18.7
        read_boundmethod                37.6    37.9    29.6    26.9    27.7   41.1
    
    Variable and attribute write access:
        write_local                      8.7     9.3     5.5     5.3     4.3    4.3
        write_nonlocal                  10.5    11.1     5.6     5.5     4.7    4.8
        write_global                    19.7    21.2    18.0    18.0    15.8   16.7
        write_classvar                  92.9    96.0   104.6   102.1    39.2   39.8
        write_instancevar               44.6    45.8    40.0    38.9    35.5   37.4
        write_instancevar_slots         35.6    36.1    27.3    26.6    25.7   25.8
    
    Data structure read access:
        read_list                       24.2    24.5    20.8    20.8    19.0   19.5
        read_deque                      24.7    25.5    20.2    20.6    19.8   20.2
        read_dict                       24.3    25.7    22.3    23.0    21.0   22.4
        read_strdict                    22.6    24.3    19.5    21.2    18.9   21.5
    
    Data structure write access:
        write_list                      27.1    28.5    22.5    21.6    20.0   20.0
        write_deque                     28.7    30.1    22.7    21.8    23.5   21.7
        write_dict                      31.4    33.3    29.3    29.2    24.7   25.4
        write_strdict                   28.4    29.9    27.5    25.2    23.1   24.5
    
    Stack (or queue) operations:
        list_append_pop                 93.4   112.7    75.4    74.2    50.8   50.6
        deque_append_pop                43.5    57.0    49.4    49.2    42.5   44.2
        deque_append_popleft            43.7    57.3    49.7    49.7    42.8   46.4
    
    Timing loop:
        loop_overhead                    0.5     0.6     0.4     0.3     0.3    0.3
    
    56 cũ đã bị xóa, nó đã bị phản đối kể từ Python 3,4. Sử dụng các hàm
    Python version                       3.4     3.5     3.6     3.7     3.8    3.9
    --------------                       ---     ---     ---     ---     ---    ---
    
    Variable and attribute read access:
        read_local                       7.1     7.1     5.4     5.1     3.9    3.9
        read_nonlocal                    7.1     8.1     5.8     5.4     4.4    4.5
        read_global                     15.5    19.0    14.3    13.6     7.6    7.8
        read_builtin                    21.1    21.6    18.5    19.0     7.5    7.8
        read_classvar_from_class        25.6    26.5    20.7    19.5    18.4   17.9
        read_classvar_from_instance     22.8    23.5    18.8    17.1    16.4   16.9
        read_instancevar                32.4    33.1    28.0    26.3    25.4   25.3
        read_instancevar_slots          27.8    31.3    20.8    20.8    20.2   20.5
        read_namedtuple                 73.8    57.5    45.0    46.8    18.4   18.7
        read_boundmethod                37.6    37.9    29.6    26.9    27.7   41.1
    
    Variable and attribute write access:
        write_local                      8.7     9.3     5.5     5.3     4.3    4.3
        write_nonlocal                  10.5    11.1     5.6     5.5     4.7    4.8
        write_global                    19.7    21.2    18.0    18.0    15.8   16.7
        write_classvar                  92.9    96.0   104.6   102.1    39.2   39.8
        write_instancevar               44.6    45.8    40.0    38.9    35.5   37.4
        write_instancevar_slots         35.6    36.1    27.3    26.6    25.7   25.8
    
    Data structure read access:
        read_list                       24.2    24.5    20.8    20.8    19.0   19.5
        read_deque                      24.7    25.5    20.2    20.6    19.8   20.2
        read_dict                       24.3    25.7    22.3    23.0    21.0   22.4
        read_strdict                    22.6    24.3    19.5    21.2    18.9   21.5
    
    Data structure write access:
        write_list                      27.1    28.5    22.5    21.6    20.0   20.0
        write_deque                     28.7    30.1    22.7    21.8    23.5   21.7
        write_dict                      31.4    33.3    29.3    29.2    24.7   25.4
        write_strdict                   28.4    29.9    27.5    25.2    23.1   24.5
    
    Stack (or queue) operations:
        list_append_pop                 93.4   112.7    75.4    74.2    50.8   50.6
        deque_append_pop                43.5    57.0    49.4    49.2    42.5   44.2
        deque_append_popleft            43.7    57.3    49.7    49.7    42.8   46.4
    
    Timing loop:
        loop_overhead                    0.5     0.6     0.4     0.3     0.3    0.3
    
    57,
    Python version                       3.4     3.5     3.6     3.7     3.8    3.9
    --------------                       ---     ---     ---     ---     ---    ---
    
    Variable and attribute read access:
        read_local                       7.1     7.1     5.4     5.1     3.9    3.9
        read_nonlocal                    7.1     8.1     5.8     5.4     4.4    4.5
        read_global                     15.5    19.0    14.3    13.6     7.6    7.8
        read_builtin                    21.1    21.6    18.5    19.0     7.5    7.8
        read_classvar_from_class        25.6    26.5    20.7    19.5    18.4   17.9
        read_classvar_from_instance     22.8    23.5    18.8    17.1    16.4   16.9
        read_instancevar                32.4    33.1    28.0    26.3    25.4   25.3
        read_instancevar_slots          27.8    31.3    20.8    20.8    20.2   20.5
        read_namedtuple                 73.8    57.5    45.0    46.8    18.4   18.7
        read_boundmethod                37.6    37.9    29.6    26.9    27.7   41.1
    
    Variable and attribute write access:
        write_local                      8.7     9.3     5.5     5.3     4.3    4.3
        write_nonlocal                  10.5    11.1     5.6     5.5     4.7    4.8
        write_global                    19.7    21.2    18.0    18.0    15.8   16.7
        write_classvar                  92.9    96.0   104.6   102.1    39.2   39.8
        write_instancevar               44.6    45.8    40.0    38.9    35.5   37.4
        write_instancevar_slots         35.6    36.1    27.3    26.6    25.7   25.8
    
    Data structure read access:
        read_list                       24.2    24.5    20.8    20.8    19.0   19.5
        read_deque                      24.7    25.5    20.2    20.6    19.8   20.2
        read_dict                       24.3    25.7    22.3    23.0    21.0   22.4
        read_strdict                    22.6    24.3    19.5    21.2    18.9   21.5
    
    Data structure write access:
        write_list                      27.1    28.5    22.5    21.6    20.0   20.0
        write_deque                     28.7    30.1    22.7    21.8    23.5   21.7
        write_dict                      31.4    33.3    29.3    29.2    24.7   25.4
        write_strdict                   28.4    29.9    27.5    25.2    23.1   24.5
    
    Stack (or queue) operations:
        list_append_pop                 93.4   112.7    75.4    74.2    50.8   50.6
        deque_append_pop                43.5    57.0    49.4    49.2    42.5   44.2
        deque_append_popleft            43.7    57.3    49.7    49.7    42.8   46.4
    
    Timing loop:
        loop_overhead                    0.5     0.6     0.4     0.3     0.3    0.3
    
    58,
    def greet_all(names: list[str]) -> None:
        for name in names:
            print("Hello", name)
    
    11 và
    Python version                       3.4     3.5     3.6     3.7     3.8    3.9
    --------------                       ---     ---     ---     ---     ---    ---
    
    Variable and attribute read access:
        read_local                       7.1     7.1     5.4     5.1     3.9    3.9
        read_nonlocal                    7.1     8.1     5.8     5.4     4.4    4.5
        read_global                     15.5    19.0    14.3    13.6     7.6    7.8
        read_builtin                    21.1    21.6    18.5    19.0     7.5    7.8
        read_classvar_from_class        25.6    26.5    20.7    19.5    18.4   17.9
        read_classvar_from_instance     22.8    23.5    18.8    17.1    16.4   16.9
        read_instancevar                32.4    33.1    28.0    26.3    25.4   25.3
        read_instancevar_slots          27.8    31.3    20.8    20.8    20.2   20.5
        read_namedtuple                 73.8    57.5    45.0    46.8    18.4   18.7
        read_boundmethod                37.6    37.9    29.6    26.9    27.7   41.1
    
    Variable and attribute write access:
        write_local                      8.7     9.3     5.5     5.3     4.3    4.3
        write_nonlocal                  10.5    11.1     5.6     5.5     4.7    4.8
        write_global                    19.7    21.2    18.0    18.0    15.8   16.7
        write_classvar                  92.9    96.0   104.6   102.1    39.2   39.8
        write_instancevar               44.6    45.8    40.0    38.9    35.5   37.4
        write_instancevar_slots         35.6    36.1    27.3    26.6    25.7   25.8
    
    Data structure read access:
        read_list                       24.2    24.5    20.8    20.8    19.0   19.5
        read_deque                      24.7    25.5    20.2    20.6    19.8   20.2
        read_dict                       24.3    25.7    22.3    23.0    21.0   22.4
        read_strdict                    22.6    24.3    19.5    21.2    18.9   21.5
    
    Data structure write access:
        write_list                      27.1    28.5    22.5    21.6    20.0   20.0
        write_deque                     28.7    30.1    22.7    21.8    23.5   21.7
        write_dict                      31.4    33.3    29.3    29.2    24.7   25.4
        write_strdict                   28.4    29.9    27.5    25.2    23.1   24.5
    
    Stack (or queue) operations:
        list_append_pop                 93.4   112.7    75.4    74.2    50.8   50.6
        deque_append_pop                43.5    57.0    49.4    49.2    42.5   44.2
        deque_append_popleft            43.7    57.3    49.7    49.7    42.8   46.4
    
    Timing loop:
        loop_overhead                    0.5     0.6     0.4     0.3     0.3    0.3
    
    60. Ngoài ra, tham số use_builtin_types đã bị xóa, các đối tượng
    base->tp_traverse(self, visit, arg)
    
    7 tiêu chuẩn luôn được sử dụng thay thế. (Được đóng góp bởi Jon Janzen trong BPO-36409.)

  • Hàm C

    Python version                       3.4     3.5     3.6     3.7     3.8    3.9
    --------------                       ---     ---     ---     ---     ---    ---
    
    Variable and attribute read access:
        read_local                       7.1     7.1     5.4     5.1     3.9    3.9
        read_nonlocal                    7.1     8.1     5.8     5.4     4.4    4.5
        read_global                     15.5    19.0    14.3    13.6     7.6    7.8
        read_builtin                    21.1    21.6    18.5    19.0     7.5    7.8
        read_classvar_from_class        25.6    26.5    20.7    19.5    18.4   17.9
        read_classvar_from_instance     22.8    23.5    18.8    17.1    16.4   16.9
        read_instancevar                32.4    33.1    28.0    26.3    25.4   25.3
        read_instancevar_slots          27.8    31.3    20.8    20.8    20.2   20.5
        read_namedtuple                 73.8    57.5    45.0    46.8    18.4   18.7
        read_boundmethod                37.6    37.9    29.6    26.9    27.7   41.1
    
    Variable and attribute write access:
        write_local                      8.7     9.3     5.5     5.3     4.3    4.3
        write_nonlocal                  10.5    11.1     5.6     5.5     4.7    4.8
        write_global                    19.7    21.2    18.0    18.0    15.8   16.7
        write_classvar                  92.9    96.0   104.6   102.1    39.2   39.8
        write_instancevar               44.6    45.8    40.0    38.9    35.5   37.4
        write_instancevar_slots         35.6    36.1    27.3    26.6    25.7   25.8
    
    Data structure read access:
        read_list                       24.2    24.5    20.8    20.8    19.0   19.5
        read_deque                      24.7    25.5    20.2    20.6    19.8   20.2
        read_dict                       24.3    25.7    22.3    23.0    21.0   22.4
        read_strdict                    22.6    24.3    19.5    21.2    18.9   21.5
    
    Data structure write access:
        write_list                      27.1    28.5    22.5    21.6    20.0   20.0
        write_deque                     28.7    30.1    22.7    21.8    23.5   21.7
        write_dict                      31.4    33.3    29.3    29.2    24.7   25.4
        write_strdict                   28.4    29.9    27.5    25.2    23.1   24.5
    
    Stack (or queue) operations:
        list_append_pop                 93.4   112.7    75.4    74.2    50.8   50.6
        deque_append_pop                43.5    57.0    49.4    49.2    42.5   44.2
        deque_append_popleft            43.7    57.3    49.7    49.7    42.8   46.4
    
    Timing loop:
        loop_overhead                    0.5     0.6     0.4     0.3     0.3    0.3
    
    62 đã được loại bỏ. Nó không được ghi nhận, thử nghiệm hoặc sử dụng ở bất cứ đâu trong CPython sau khi thực hiện PEP 442. Bản vá của Joannah Nanjekye. (Được đóng góp bởi Joannah Nanjekye trong BPO-15088)PEP 442. Patch by Joannah Nanjekye. (Contributed by Joannah Nanjekye in bpo-15088)

  • Python version                       3.4     3.5     3.6     3.7     3.8    3.9
    --------------                       ---     ---     ---     ---     ---    ---
    
    Variable and attribute read access:
        read_local                       7.1     7.1     5.4     5.1     3.9    3.9
        read_nonlocal                    7.1     8.1     5.8     5.4     4.4    4.5
        read_global                     15.5    19.0    14.3    13.6     7.6    7.8
        read_builtin                    21.1    21.6    18.5    19.0     7.5    7.8
        read_classvar_from_class        25.6    26.5    20.7    19.5    18.4   17.9
        read_classvar_from_instance     22.8    23.5    18.8    17.1    16.4   16.9
        read_instancevar                32.4    33.1    28.0    26.3    25.4   25.3
        read_instancevar_slots          27.8    31.3    20.8    20.8    20.2   20.5
        read_namedtuple                 73.8    57.5    45.0    46.8    18.4   18.7
        read_boundmethod                37.6    37.9    29.6    26.9    27.7   41.1
    
    Variable and attribute write access:
        write_local                      8.7     9.3     5.5     5.3     4.3    4.3
        write_nonlocal                  10.5    11.1     5.6     5.5     4.7    4.8
        write_global                    19.7    21.2    18.0    18.0    15.8   16.7
        write_classvar                  92.9    96.0   104.6   102.1    39.2   39.8
        write_instancevar               44.6    45.8    40.0    38.9    35.5   37.4
        write_instancevar_slots         35.6    36.1    27.3    26.6    25.7   25.8
    
    Data structure read access:
        read_list                       24.2    24.5    20.8    20.8    19.0   19.5
        read_deque                      24.7    25.5    20.2    20.6    19.8   20.2
        read_dict                       24.3    25.7    22.3    23.0    21.0   22.4
        read_strdict                    22.6    24.3    19.5    21.2    18.9   21.5
    
    Data structure write access:
        write_list                      27.1    28.5    22.5    21.6    20.0   20.0
        write_deque                     28.7    30.1    22.7    21.8    23.5   21.7
        write_dict                      31.4    33.3    29.3    29.2    24.7   25.4
        write_strdict                   28.4    29.9    27.5    25.2    23.1   24.5
    
    Stack (or queue) operations:
        list_append_pop                 93.4   112.7    75.4    74.2    50.8   50.6
        deque_append_pop                43.5    57.0    49.4    49.2    42.5   44.2
        deque_append_popleft            43.7    57.3    49.7    49.7    42.8   46.4
    
    Timing loop:
        loop_overhead                    0.5     0.6     0.4     0.3     0.3    0.3
    
    63 và
    Python version                       3.4     3.5     3.6     3.7     3.8    3.9
    --------------                       ---     ---     ---     ---     ---    ---
    
    Variable and attribute read access:
        read_local                       7.1     7.1     5.4     5.1     3.9    3.9
        read_nonlocal                    7.1     8.1     5.8     5.4     4.4    4.5
        read_global                     15.5    19.0    14.3    13.6     7.6    7.8
        read_builtin                    21.1    21.6    18.5    19.0     7.5    7.8
        read_classvar_from_class        25.6    26.5    20.7    19.5    18.4   17.9
        read_classvar_from_instance     22.8    23.5    18.8    17.1    16.4   16.9
        read_instancevar                32.4    33.1    28.0    26.3    25.4   25.3
        read_instancevar_slots          27.8    31.3    20.8    20.8    20.2   20.5
        read_namedtuple                 73.8    57.5    45.0    46.8    18.4   18.7
        read_boundmethod                37.6    37.9    29.6    26.9    27.7   41.1
    
    Variable and attribute write access:
        write_local                      8.7     9.3     5.5     5.3     4.3    4.3
        write_nonlocal                  10.5    11.1     5.6     5.5     4.7    4.8
        write_global                    19.7    21.2    18.0    18.0    15.8   16.7
        write_classvar                  92.9    96.0   104.6   102.1    39.2   39.8
        write_instancevar               44.6    45.8    40.0    38.9    35.5   37.4
        write_instancevar_slots         35.6    36.1    27.3    26.6    25.7   25.8
    
    Data structure read access:
        read_list                       24.2    24.5    20.8    20.8    19.0   19.5
        read_deque                      24.7    25.5    20.2    20.6    19.8   20.2
        read_dict                       24.3    25.7    22.3    23.0    21.0   22.4
        read_strdict                    22.6    24.3    19.5    21.2    18.9   21.5
    
    Data structure write access:
        write_list                      27.1    28.5    22.5    21.6    20.0   20.0
        write_deque                     28.7    30.1    22.7    21.8    23.5   21.7
        write_dict                      31.4    33.3    29.3    29.2    24.7   25.4
        write_strdict                   28.4    29.9    27.5    25.2    23.1   24.5
    
    Stack (or queue) operations:
        list_append_pop                 93.4   112.7    75.4    74.2    50.8   50.6
        deque_append_pop                43.5    57.0    49.4    49.2    42.5   44.2
        deque_append_popleft            43.7    57.3    49.7    49.7    42.8   46.4
    
    Timing loop:
        loop_overhead                    0.5     0.6     0.4     0.3     0.3    0.3
    
    64, các bí danh không được chấp nhận kể từ Python 3.1, đã bị xóa: sử dụng
    Python version                       3.4     3.5     3.6     3.7     3.8    3.9
    --------------                       ---     ---     ---     ---     ---    ---
    
    Variable and attribute read access:
        read_local                       7.1     7.1     5.4     5.1     3.9    3.9
        read_nonlocal                    7.1     8.1     5.8     5.4     4.4    4.5
        read_global                     15.5    19.0    14.3    13.6     7.6    7.8
        read_builtin                    21.1    21.6    18.5    19.0     7.5    7.8
        read_classvar_from_class        25.6    26.5    20.7    19.5    18.4   17.9
        read_classvar_from_instance     22.8    23.5    18.8    17.1    16.4   16.9
        read_instancevar                32.4    33.1    28.0    26.3    25.4   25.3
        read_instancevar_slots          27.8    31.3    20.8    20.8    20.2   20.5
        read_namedtuple                 73.8    57.5    45.0    46.8    18.4   18.7
        read_boundmethod                37.6    37.9    29.6    26.9    27.7   41.1
    
    Variable and attribute write access:
        write_local                      8.7     9.3     5.5     5.3     4.3    4.3
        write_nonlocal                  10.5    11.1     5.6     5.5     4.7    4.8
        write_global                    19.7    21.2    18.0    18.0    15.8   16.7
        write_classvar                  92.9    96.0   104.6   102.1    39.2   39.8
        write_instancevar               44.6    45.8    40.0    38.9    35.5   37.4
        write_instancevar_slots         35.6    36.1    27.3    26.6    25.7   25.8
    
    Data structure read access:
        read_list                       24.2    24.5    20.8    20.8    19.0   19.5
        read_deque                      24.7    25.5    20.2    20.6    19.8   20.2
        read_dict                       24.3    25.7    22.3    23.0    21.0   22.4
        read_strdict                    22.6    24.3    19.5    21.2    18.9   21.5
    
    Data structure write access:
        write_list                      27.1    28.5    22.5    21.6    20.0   20.0
        write_deque                     28.7    30.1    22.7    21.8    23.5   21.7
        write_dict                      31.4    33.3    29.3    29.2    24.7   25.4
        write_strdict                   28.4    29.9    27.5    25.2    23.1   24.5
    
    Stack (or queue) operations:
        list_append_pop                 93.4   112.7    75.4    74.2    50.8   50.6
        deque_append_pop                43.5    57.0    49.4    49.2    42.5   44.2
        deque_append_popleft            43.7    57.3    49.7    49.7    42.8   46.4
    
    Timing loop:
        loop_overhead                    0.5     0.6     0.4     0.3     0.3    0.3
    
    65 và
    Python version                       3.4     3.5     3.6     3.7     3.8    3.9
    --------------                       ---     ---     ---     ---     ---    ---
    
    Variable and attribute read access:
        read_local                       7.1     7.1     5.4     5.1     3.9    3.9
        read_nonlocal                    7.1     8.1     5.8     5.4     4.4    4.5
        read_global                     15.5    19.0    14.3    13.6     7.6    7.8
        read_builtin                    21.1    21.6    18.5    19.0     7.5    7.8
        read_classvar_from_class        25.6    26.5    20.7    19.5    18.4   17.9
        read_classvar_from_instance     22.8    23.5    18.8    17.1    16.4   16.9
        read_instancevar                32.4    33.1    28.0    26.3    25.4   25.3
        read_instancevar_slots          27.8    31.3    20.8    20.8    20.2   20.5
        read_namedtuple                 73.8    57.5    45.0    46.8    18.4   18.7
        read_boundmethod                37.6    37.9    29.6    26.9    27.7   41.1
    
    Variable and attribute write access:
        write_local                      8.7     9.3     5.5     5.3     4.3    4.3
        write_nonlocal                  10.5    11.1     5.6     5.5     4.7    4.8
        write_global                    19.7    21.2    18.0    18.0    15.8   16.7
        write_classvar                  92.9    96.0   104.6   102.1    39.2   39.8
        write_instancevar               44.6    45.8    40.0    38.9    35.5   37.4
        write_instancevar_slots         35.6    36.1    27.3    26.6    25.7   25.8
    
    Data structure read access:
        read_list                       24.2    24.5    20.8    20.8    19.0   19.5
        read_deque                      24.7    25.5    20.2    20.6    19.8   20.2
        read_dict                       24.3    25.7    22.3    23.0    21.0   22.4
        read_strdict                    22.6    24.3    19.5    21.2    18.9   21.5
    
    Data structure write access:
        write_list                      27.1    28.5    22.5    21.6    20.0   20.0
        write_deque                     28.7    30.1    22.7    21.8    23.5   21.7
        write_dict                      31.4    33.3    29.3    29.2    24.7   25.4
        write_strdict                   28.4    29.9    27.5    25.2    23.1   24.5
    
    Stack (or queue) operations:
        list_append_pop                 93.4   112.7    75.4    74.2    50.8   50.6
        deque_append_pop                43.5    57.0    49.4    49.2    42.5   44.2
        deque_append_popleft            43.7    57.3    49.7    49.7    42.8   46.4
    
    Timing loop:
        loop_overhead                    0.5     0.6     0.4     0.3     0.3    0.3
    
    66 thay thế. (Được đóng góp bởi Victor Stinner trong BPO-39351.)

  • Hàm

    Python version                       3.4     3.5     3.6     3.7     3.8    3.9
    --------------                       ---     ---     ---     ---     ---    ---
    
    Variable and attribute read access:
        read_local                       7.1     7.1     5.4     5.1     3.9    3.9
        read_nonlocal                    7.1     8.1     5.8     5.4     4.4    4.5
        read_global                     15.5    19.0    14.3    13.6     7.6    7.8
        read_builtin                    21.1    21.6    18.5    19.0     7.5    7.8
        read_classvar_from_class        25.6    26.5    20.7    19.5    18.4   17.9
        read_classvar_from_instance     22.8    23.5    18.8    17.1    16.4   16.9
        read_instancevar                32.4    33.1    28.0    26.3    25.4   25.3
        read_instancevar_slots          27.8    31.3    20.8    20.8    20.2   20.5
        read_namedtuple                 73.8    57.5    45.0    46.8    18.4   18.7
        read_boundmethod                37.6    37.9    29.6    26.9    27.7   41.1
    
    Variable and attribute write access:
        write_local                      8.7     9.3     5.5     5.3     4.3    4.3
        write_nonlocal                  10.5    11.1     5.6     5.5     4.7    4.8
        write_global                    19.7    21.2    18.0    18.0    15.8   16.7
        write_classvar                  92.9    96.0   104.6   102.1    39.2   39.8
        write_instancevar               44.6    45.8    40.0    38.9    35.5   37.4
        write_instancevar_slots         35.6    36.1    27.3    26.6    25.7   25.8
    
    Data structure read access:
        read_list                       24.2    24.5    20.8    20.8    19.0   19.5
        read_deque                      24.7    25.5    20.2    20.6    19.8   20.2
        read_dict                       24.3    25.7    22.3    23.0    21.0   22.4
        read_strdict                    22.6    24.3    19.5    21.2    18.9   21.5
    
    Data structure write access:
        write_list                      27.1    28.5    22.5    21.6    20.0   20.0
        write_deque                     28.7    30.1    22.7    21.8    23.5   21.7
        write_dict                      31.4    33.3    29.3    29.2    24.7   25.4
        write_strdict                   28.4    29.9    27.5    25.2    23.1   24.5
    
    Stack (or queue) operations:
        list_append_pop                 93.4   112.7    75.4    74.2    50.8   50.6
        deque_append_pop                43.5    57.0    49.4    49.2    42.5   44.2
        deque_append_popleft            43.7    57.3    49.7    49.7    42.8   46.4
    
    Timing loop:
        loop_overhead                    0.5     0.6     0.4     0.3     0.3    0.3
    
    67 đã bị loại bỏ, nó đã được dùng hết kể từ Python 3.5 (BPO-22486): sử dụng
    def greet_all(names: list[str]) -> None:
        for name in names:
            print("Hello", name)
    
    83 thay thế. (Được đóng góp bởi Victor Stinner trong BPO-39350.)

  • Tham số bộ đệm của

    Python version                       3.4     3.5     3.6     3.7     3.8    3.9
    --------------                       ---     ---     ---     ---     ---    ---
    
    Variable and attribute read access:
        read_local                       7.1     7.1     5.4     5.1     3.9    3.9
        read_nonlocal                    7.1     8.1     5.8     5.4     4.4    4.5
        read_global                     15.5    19.0    14.3    13.6     7.6    7.8
        read_builtin                    21.1    21.6    18.5    19.0     7.5    7.8
        read_classvar_from_class        25.6    26.5    20.7    19.5    18.4   17.9
        read_classvar_from_instance     22.8    23.5    18.8    17.1    16.4   16.9
        read_instancevar                32.4    33.1    28.0    26.3    25.4   25.3
        read_instancevar_slots          27.8    31.3    20.8    20.8    20.2   20.5
        read_namedtuple                 73.8    57.5    45.0    46.8    18.4   18.7
        read_boundmethod                37.6    37.9    29.6    26.9    27.7   41.1
    
    Variable and attribute write access:
        write_local                      8.7     9.3     5.5     5.3     4.3    4.3
        write_nonlocal                  10.5    11.1     5.6     5.5     4.7    4.8
        write_global                    19.7    21.2    18.0    18.0    15.8   16.7
        write_classvar                  92.9    96.0   104.6   102.1    39.2   39.8
        write_instancevar               44.6    45.8    40.0    38.9    35.5   37.4
        write_instancevar_slots         35.6    36.1    27.3    26.6    25.7   25.8
    
    Data structure read access:
        read_list                       24.2    24.5    20.8    20.8    19.0   19.5
        read_deque                      24.7    25.5    20.2    20.6    19.8   20.2
        read_dict                       24.3    25.7    22.3    23.0    21.0   22.4
        read_strdict                    22.6    24.3    19.5    21.2    18.9   21.5
    
    Data structure write access:
        write_list                      27.1    28.5    22.5    21.6    20.0   20.0
        write_deque                     28.7    30.1    22.7    21.8    23.5   21.7
        write_dict                      31.4    33.3    29.3    29.2    24.7   25.4
        write_strdict                   28.4    29.9    27.5    25.2    23.1   24.5
    
    Stack (or queue) operations:
        list_append_pop                 93.4   112.7    75.4    74.2    50.8   50.6
        deque_append_pop                43.5    57.0    49.4    49.2    42.5   44.2
        deque_append_popleft            43.7    57.3    49.7    49.7    42.8   46.4
    
    Timing loop:
        loop_overhead                    0.5     0.6     0.4     0.3     0.3    0.3
    
    69 đã được gỡ bỏ. Kể từ Python 3.0, nó đã bị bỏ qua và sử dụng nó phát ra một
    Python version                       3.4     3.5     3.6     3.7     3.8    3.9
    --------------                       ---     ---     ---     ---     ---    ---
    
    Variable and attribute read access:
        read_local                       7.1     7.1     5.4     5.1     3.9    3.9
        read_nonlocal                    7.1     8.1     5.8     5.4     4.4    4.5
        read_global                     15.5    19.0    14.3    13.6     7.6    7.8
        read_builtin                    21.1    21.6    18.5    19.0     7.5    7.8
        read_classvar_from_class        25.6    26.5    20.7    19.5    18.4   17.9
        read_classvar_from_instance     22.8    23.5    18.8    17.1    16.4   16.9
        read_instancevar                32.4    33.1    28.0    26.3    25.4   25.3
        read_instancevar_slots          27.8    31.3    20.8    20.8    20.2   20.5
        read_namedtuple                 73.8    57.5    45.0    46.8    18.4   18.7
        read_boundmethod                37.6    37.9    29.6    26.9    27.7   41.1
    
    Variable and attribute write access:
        write_local                      8.7     9.3     5.5     5.3     4.3    4.3
        write_nonlocal                  10.5    11.1     5.6     5.5     4.7    4.8
        write_global                    19.7    21.2    18.0    18.0    15.8   16.7
        write_classvar                  92.9    96.0   104.6   102.1    39.2   39.8
        write_instancevar               44.6    45.8    40.0    38.9    35.5   37.4
        write_instancevar_slots         35.6    36.1    27.3    26.6    25.7   25.8
    
    Data structure read access:
        read_list                       24.2    24.5    20.8    20.8    19.0   19.5
        read_deque                      24.7    25.5    20.2    20.6    19.8   20.2
        read_dict                       24.3    25.7    22.3    23.0    21.0   22.4
        read_strdict                    22.6    24.3    19.5    21.2    18.9   21.5
    
    Data structure write access:
        write_list                      27.1    28.5    22.5    21.6    20.0   20.0
        write_deque                     28.7    30.1    22.7    21.8    23.5   21.7
        write_dict                      31.4    33.3    29.3    29.2    24.7   25.4
        write_strdict                   28.4    29.9    27.5    25.2    23.1   24.5
    
    Stack (or queue) operations:
        list_append_pop                 93.4   112.7    75.4    74.2    50.8   50.6
        deque_append_pop                43.5    57.0    49.4    49.2    42.5   44.2
        deque_append_popleft            43.7    57.3    49.7    49.7    42.8   46.4
    
    Timing loop:
        loop_overhead                    0.5     0.6     0.4     0.3     0.3    0.3
    
    7. Vượt qua một đối tượng tệp mở để kiểm soát cách mở tệp. (Được đóng góp bởi Victor Stinner trong BPO-39357.)

  • Tham số mã hóa của

    Python version                       3.4     3.5     3.6     3.7     3.8    3.9
    --------------                       ---     ---     ---     ---     ---    ---
    
    Variable and attribute read access:
        read_local                       7.1     7.1     5.4     5.1     3.9    3.9
        read_nonlocal                    7.1     8.1     5.8     5.4     4.4    4.5
        read_global                     15.5    19.0    14.3    13.6     7.6    7.8
        read_builtin                    21.1    21.6    18.5    19.0     7.5    7.8
        read_classvar_from_class        25.6    26.5    20.7    19.5    18.4   17.9
        read_classvar_from_instance     22.8    23.5    18.8    17.1    16.4   16.9
        read_instancevar                32.4    33.1    28.0    26.3    25.4   25.3
        read_instancevar_slots          27.8    31.3    20.8    20.8    20.2   20.5
        read_namedtuple                 73.8    57.5    45.0    46.8    18.4   18.7
        read_boundmethod                37.6    37.9    29.6    26.9    27.7   41.1
    
    Variable and attribute write access:
        write_local                      8.7     9.3     5.5     5.3     4.3    4.3
        write_nonlocal                  10.5    11.1     5.6     5.5     4.7    4.8
        write_global                    19.7    21.2    18.0    18.0    15.8   16.7
        write_classvar                  92.9    96.0   104.6   102.1    39.2   39.8
        write_instancevar               44.6    45.8    40.0    38.9    35.5   37.4
        write_instancevar_slots         35.6    36.1    27.3    26.6    25.7   25.8
    
    Data structure read access:
        read_list                       24.2    24.5    20.8    20.8    19.0   19.5
        read_deque                      24.7    25.5    20.2    20.6    19.8   20.2
        read_dict                       24.3    25.7    22.3    23.0    21.0   22.4
        read_strdict                    22.6    24.3    19.5    21.2    18.9   21.5
    
    Data structure write access:
        write_list                      27.1    28.5    22.5    21.6    20.0   20.0
        write_deque                     28.7    30.1    22.7    21.8    23.5   21.7
        write_dict                      31.4    33.3    29.3    29.2    24.7   25.4
        write_strdict                   28.4    29.9    27.5    25.2    23.1   24.5
    
    Stack (or queue) operations:
        list_append_pop                 93.4   112.7    75.4    74.2    50.8   50.6
        deque_append_pop                43.5    57.0    49.4    49.2    42.5   44.2
        deque_append_popleft            43.7    57.3    49.7    49.7    42.8   46.4
    
    Timing loop:
        loop_overhead                    0.5     0.6     0.4     0.3     0.3    0.3
    
    71 đã bị xóa. Kể từ Python 3.1, nó đã bị phản đối và bỏ qua; Sử dụng nó đã phát ra một
    Python version                       3.4     3.5     3.6     3.7     3.8    3.9
    --------------                       ---     ---     ---     ---     ---    ---
    
    Variable and attribute read access:
        read_local                       7.1     7.1     5.4     5.1     3.9    3.9
        read_nonlocal                    7.1     8.1     5.8     5.4     4.4    4.5
        read_global                     15.5    19.0    14.3    13.6     7.6    7.8
        read_builtin                    21.1    21.6    18.5    19.0     7.5    7.8
        read_classvar_from_class        25.6    26.5    20.7    19.5    18.4   17.9
        read_classvar_from_instance     22.8    23.5    18.8    17.1    16.4   16.9
        read_instancevar                32.4    33.1    28.0    26.3    25.4   25.3
        read_instancevar_slots          27.8    31.3    20.8    20.8    20.2   20.5
        read_namedtuple                 73.8    57.5    45.0    46.8    18.4   18.7
        read_boundmethod                37.6    37.9    29.6    26.9    27.7   41.1
    
    Variable and attribute write access:
        write_local                      8.7     9.3     5.5     5.3     4.3    4.3
        write_nonlocal                  10.5    11.1     5.6     5.5     4.7    4.8
        write_global                    19.7    21.2    18.0    18.0    15.8   16.7
        write_classvar                  92.9    96.0   104.6   102.1    39.2   39.8
        write_instancevar               44.6    45.8    40.0    38.9    35.5   37.4
        write_instancevar_slots         35.6    36.1    27.3    26.6    25.7   25.8
    
    Data structure read access:
        read_list                       24.2    24.5    20.8    20.8    19.0   19.5
        read_deque                      24.7    25.5    20.2    20.6    19.8   20.2
        read_dict                       24.3    25.7    22.3    23.0    21.0   22.4
        read_strdict                    22.6    24.3    19.5    21.2    18.9   21.5
    
    Data structure write access:
        write_list                      27.1    28.5    22.5    21.6    20.0   20.0
        write_deque                     28.7    30.1    22.7    21.8    23.5   21.7
        write_dict                      31.4    33.3    29.3    29.2    24.7   25.4
        write_strdict                   28.4    29.9    27.5    25.2    23.1   24.5
    
    Stack (or queue) operations:
        list_append_pop                 93.4   112.7    75.4    74.2    50.8   50.6
        deque_append_pop                43.5    57.0    49.4    49.2    42.5   44.2
        deque_append_popleft            43.7    57.3    49.7    49.7    42.8   46.4
    
    Timing loop:
        loop_overhead                    0.5     0.6     0.4     0.3     0.3    0.3
    
    7 kể từ Python 3.8. (Được đóng góp bởi Inada Naoki trong BPO-39377)

  • Các câu lệnh

    Python version                       3.4     3.5     3.6     3.7     3.8    3.9
    --------------                       ---     ---     ---     ---     ---    ---
    
    Variable and attribute read access:
        read_local                       7.1     7.1     5.4     5.1     3.9    3.9
        read_nonlocal                    7.1     8.1     5.8     5.4     4.4    4.5
        read_global                     15.5    19.0    14.3    13.6     7.6    7.8
        read_builtin                    21.1    21.6    18.5    19.0     7.5    7.8
        read_classvar_from_class        25.6    26.5    20.7    19.5    18.4   17.9
        read_classvar_from_instance     22.8    23.5    18.8    17.1    16.4   16.9
        read_instancevar                32.4    33.1    28.0    26.3    25.4   25.3
        read_instancevar_slots          27.8    31.3    20.8    20.8    20.2   20.5
        read_namedtuple                 73.8    57.5    45.0    46.8    18.4   18.7
        read_boundmethod                37.6    37.9    29.6    26.9    27.7   41.1
    
    Variable and attribute write access:
        write_local                      8.7     9.3     5.5     5.3     4.3    4.3
        write_nonlocal                  10.5    11.1     5.6     5.5     4.7    4.8
        write_global                    19.7    21.2    18.0    18.0    15.8   16.7
        write_classvar                  92.9    96.0   104.6   102.1    39.2   39.8
        write_instancevar               44.6    45.8    40.0    38.9    35.5   37.4
        write_instancevar_slots         35.6    36.1    27.3    26.6    25.7   25.8
    
    Data structure read access:
        read_list                       24.2    24.5    20.8    20.8    19.0   19.5
        read_deque                      24.7    25.5    20.2    20.6    19.8   20.2
        read_dict                       24.3    25.7    22.3    23.0    21.0   22.4
        read_strdict                    22.6    24.3    19.5    21.2    18.9   21.5
    
    Data structure write access:
        write_list                      27.1    28.5    22.5    21.6    20.0   20.0
        write_deque                     28.7    30.1    22.7    21.8    23.5   21.7
        write_dict                      31.4    33.3    29.3    29.2    24.7   25.4
        write_strdict                   28.4    29.9    27.5    25.2    23.1   24.5
    
    Stack (or queue) operations:
        list_append_pop                 93.4   112.7    75.4    74.2    50.8   50.6
        deque_append_pop                43.5    57.0    49.4    49.2    42.5   44.2
        deque_append_popleft            43.7    57.3    49.7    49.7    42.8   46.4
    
    Timing loop:
        loop_overhead                    0.5     0.6     0.4     0.3     0.3    0.3
    
    73 và
    Python version                       3.4     3.5     3.6     3.7     3.8    3.9
    --------------                       ---     ---     ---     ---     ---    ---
    
    Variable and attribute read access:
        read_local                       7.1     7.1     5.4     5.1     3.9    3.9
        read_nonlocal                    7.1     8.1     5.8     5.4     4.4    4.5
        read_global                     15.5    19.0    14.3    13.6     7.6    7.8
        read_builtin                    21.1    21.6    18.5    19.0     7.5    7.8
        read_classvar_from_class        25.6    26.5    20.7    19.5    18.4   17.9
        read_classvar_from_instance     22.8    23.5    18.8    17.1    16.4   16.9
        read_instancevar                32.4    33.1    28.0    26.3    25.4   25.3
        read_instancevar_slots          27.8    31.3    20.8    20.8    20.2   20.5
        read_namedtuple                 73.8    57.5    45.0    46.8    18.4   18.7
        read_boundmethod                37.6    37.9    29.6    26.9    27.7   41.1
    
    Variable and attribute write access:
        write_local                      8.7     9.3     5.5     5.3     4.3    4.3
        write_nonlocal                  10.5    11.1     5.6     5.5     4.7    4.8
        write_global                    19.7    21.2    18.0    18.0    15.8   16.7
        write_classvar                  92.9    96.0   104.6   102.1    39.2   39.8
        write_instancevar               44.6    45.8    40.0    38.9    35.5   37.4
        write_instancevar_slots         35.6    36.1    27.3    26.6    25.7   25.8
    
    Data structure read access:
        read_list                       24.2    24.5    20.8    20.8    19.0   19.5
        read_deque                      24.7    25.5    20.2    20.6    19.8   20.2
        read_dict                       24.3    25.7    22.3    23.0    21.0   22.4
        read_strdict                    22.6    24.3    19.5    21.2    18.9   21.5
    
    Data structure write access:
        write_list                      27.1    28.5    22.5    21.6    20.0   20.0
        write_deque                     28.7    30.1    22.7    21.8    23.5   21.7
        write_dict                      31.4    33.3    29.3    29.2    24.7   25.4
        write_strdict                   28.4    29.9    27.5    25.2    23.1   24.5
    
    Stack (or queue) operations:
        list_append_pop                 93.4   112.7    75.4    74.2    50.8   50.6
        deque_append_pop                43.5    57.0    49.4    49.2    42.5   44.2
        deque_append_popleft            43.7    57.3    49.7    49.7    42.8   46.4
    
    Timing loop:
        loop_overhead                    0.5     0.6     0.4     0.3     0.3    0.3
    
    74 không còn được hỗ trợ, sử dụng
    Python version                       3.4     3.5     3.6     3.7     3.8    3.9
    --------------                       ---     ---     ---     ---     ---    ---
    
    Variable and attribute read access:
        read_local                       7.1     7.1     5.4     5.1     3.9    3.9
        read_nonlocal                    7.1     8.1     5.8     5.4     4.4    4.5
        read_global                     15.5    19.0    14.3    13.6     7.6    7.8
        read_builtin                    21.1    21.6    18.5    19.0     7.5    7.8
        read_classvar_from_class        25.6    26.5    20.7    19.5    18.4   17.9
        read_classvar_from_instance     22.8    23.5    18.8    17.1    16.4   16.9
        read_instancevar                32.4    33.1    28.0    26.3    25.4   25.3
        read_instancevar_slots          27.8    31.3    20.8    20.8    20.2   20.5
        read_namedtuple                 73.8    57.5    45.0    46.8    18.4   18.7
        read_boundmethod                37.6    37.9    29.6    26.9    27.7   41.1
    
    Variable and attribute write access:
        write_local                      8.7     9.3     5.5     5.3     4.3    4.3
        write_nonlocal                  10.5    11.1     5.6     5.5     4.7    4.8
        write_global                    19.7    21.2    18.0    18.0    15.8   16.7
        write_classvar                  92.9    96.0   104.6   102.1    39.2   39.8
        write_instancevar               44.6    45.8    40.0    38.9    35.5   37.4
        write_instancevar_slots         35.6    36.1    27.3    26.6    25.7   25.8
    
    Data structure read access:
        read_list                       24.2    24.5    20.8    20.8    19.0   19.5
        read_deque                      24.7    25.5    20.2    20.6    19.8   20.2
        read_dict                       24.3    25.7    22.3    23.0    21.0   22.4
        read_strdict                    22.6    24.3    19.5    21.2    18.9   21.5
    
    Data structure write access:
        write_list                      27.1    28.5    22.5    21.6    20.0   20.0
        write_deque                     28.7    30.1    22.7    21.8    23.5   21.7
        write_dict                      31.4    33.3    29.3    29.2    24.7   25.4
        write_strdict                   28.4    29.9    27.5    25.2    23.1   24.5
    
    Stack (or queue) operations:
        list_append_pop                 93.4   112.7    75.4    74.2    50.8   50.6
        deque_append_pop                43.5    57.0    49.4    49.2    42.5   44.2
        deque_append_popleft            43.7    57.3    49.7    49.7    42.8   46.4
    
    Timing loop:
        loop_overhead                    0.5     0.6     0.4     0.3     0.3    0.3
    
    75 thay thế. Điều tương tự là chính xác cho
    Python version                       3.4     3.5     3.6     3.7     3.8    3.9
    --------------                       ---     ---     ---     ---     ---    ---
    
    Variable and attribute read access:
        read_local                       7.1     7.1     5.4     5.1     3.9    3.9
        read_nonlocal                    7.1     8.1     5.8     5.4     4.4    4.5
        read_global                     15.5    19.0    14.3    13.6     7.6    7.8
        read_builtin                    21.1    21.6    18.5    19.0     7.5    7.8
        read_classvar_from_class        25.6    26.5    20.7    19.5    18.4   17.9
        read_classvar_from_instance     22.8    23.5    18.8    17.1    16.4   16.9
        read_instancevar                32.4    33.1    28.0    26.3    25.4   25.3
        read_instancevar_slots          27.8    31.3    20.8    20.8    20.2   20.5
        read_namedtuple                 73.8    57.5    45.0    46.8    18.4   18.7
        read_boundmethod                37.6    37.9    29.6    26.9    27.7   41.1
    
    Variable and attribute write access:
        write_local                      8.7     9.3     5.5     5.3     4.3    4.3
        write_nonlocal                  10.5    11.1     5.6     5.5     4.7    4.8
        write_global                    19.7    21.2    18.0    18.0    15.8   16.7
        write_classvar                  92.9    96.0   104.6   102.1    39.2   39.8
        write_instancevar               44.6    45.8    40.0    38.9    35.5   37.4
        write_instancevar_slots         35.6    36.1    27.3    26.6    25.7   25.8
    
    Data structure read access:
        read_list                       24.2    24.5    20.8    20.8    19.0   19.5
        read_deque                      24.7    25.5    20.2    20.6    19.8   20.2
        read_dict                       24.3    25.7    22.3    23.0    21.0   22.4
        read_strdict                    22.6    24.3    19.5    21.2    18.9   21.5
    
    Data structure write access:
        write_list                      27.1    28.5    22.5    21.6    20.0   20.0
        write_deque                     28.7    30.1    22.7    21.8    23.5   21.7
        write_dict                      31.4    33.3    29.3    29.2    24.7   25.4
        write_strdict                   28.4    29.9    27.5    25.2    23.1   24.5
    
    Stack (or queue) operations:
        list_append_pop                 93.4   112.7    75.4    74.2    50.8   50.6
        deque_append_pop                43.5    57.0    49.4    49.2    42.5   44.2
        deque_append_popleft            43.7    57.3    49.7    49.7    42.8   46.4
    
    Timing loop:
        loop_overhead                    0.5     0.6     0.4     0.3     0.3    0.3
    
    76 và
    Python version                       3.4     3.5     3.6     3.7     3.8    3.9
    --------------                       ---     ---     ---     ---     ---    ---
    
    Variable and attribute read access:
        read_local                       7.1     7.1     5.4     5.1     3.9    3.9
        read_nonlocal                    7.1     8.1     5.8     5.4     4.4    4.5
        read_global                     15.5    19.0    14.3    13.6     7.6    7.8
        read_builtin                    21.1    21.6    18.5    19.0     7.5    7.8
        read_classvar_from_class        25.6    26.5    20.7    19.5    18.4   17.9
        read_classvar_from_instance     22.8    23.5    18.8    17.1    16.4   16.9
        read_instancevar                32.4    33.1    28.0    26.3    25.4   25.3
        read_instancevar_slots          27.8    31.3    20.8    20.8    20.2   20.5
        read_namedtuple                 73.8    57.5    45.0    46.8    18.4   18.7
        read_boundmethod                37.6    37.9    29.6    26.9    27.7   41.1
    
    Variable and attribute write access:
        write_local                      8.7     9.3     5.5     5.3     4.3    4.3
        write_nonlocal                  10.5    11.1     5.6     5.5     4.7    4.8
        write_global                    19.7    21.2    18.0    18.0    15.8   16.7
        write_classvar                  92.9    96.0   104.6   102.1    39.2   39.8
        write_instancevar               44.6    45.8    40.0    38.9    35.5   37.4
        write_instancevar_slots         35.6    36.1    27.3    26.6    25.7   25.8
    
    Data structure read access:
        read_list                       24.2    24.5    20.8    20.8    19.0   19.5
        read_deque                      24.7    25.5    20.2    20.6    19.8   20.2
        read_dict                       24.3    25.7    22.3    23.0    21.0   22.4
        read_strdict                    22.6    24.3    19.5    21.2    18.9   21.5
    
    Data structure write access:
        write_list                      27.1    28.5    22.5    21.6    20.0   20.0
        write_deque                     28.7    30.1    22.7    21.8    23.5   21.7
        write_dict                      31.4    33.3    29.3    29.2    24.7   25.4
        write_strdict                   28.4    29.9    27.5    25.2    23.1   24.5
    
    Stack (or queue) operations:
        list_append_pop                 93.4   112.7    75.4    74.2    50.8   50.6
        deque_append_pop                43.5    57.0    49.4    49.2    42.5   44.2
        deque_append_popleft            43.7    57.3    49.7    49.7    42.8   46.4
    
    Timing loop:
        loop_overhead                    0.5     0.6     0.4     0.3     0.3    0.3
    
    77. (Được đóng góp bởi Andrew Svetlov trong BPO-34793.)

  • Hàm

    Python version                       3.4     3.5     3.6     3.7     3.8    3.9
    --------------                       ---     ---     ---     ---     ---    ---
    
    Variable and attribute read access:
        read_local                       7.1     7.1     5.4     5.1     3.9    3.9
        read_nonlocal                    7.1     8.1     5.8     5.4     4.4    4.5
        read_global                     15.5    19.0    14.3    13.6     7.6    7.8
        read_builtin                    21.1    21.6    18.5    19.0     7.5    7.8
        read_classvar_from_class        25.6    26.5    20.7    19.5    18.4   17.9
        read_classvar_from_instance     22.8    23.5    18.8    17.1    16.4   16.9
        read_instancevar                32.4    33.1    28.0    26.3    25.4   25.3
        read_instancevar_slots          27.8    31.3    20.8    20.8    20.2   20.5
        read_namedtuple                 73.8    57.5    45.0    46.8    18.4   18.7
        read_boundmethod                37.6    37.9    29.6    26.9    27.7   41.1
    
    Variable and attribute write access:
        write_local                      8.7     9.3     5.5     5.3     4.3    4.3
        write_nonlocal                  10.5    11.1     5.6     5.5     4.7    4.8
        write_global                    19.7    21.2    18.0    18.0    15.8   16.7
        write_classvar                  92.9    96.0   104.6   102.1    39.2   39.8
        write_instancevar               44.6    45.8    40.0    38.9    35.5   37.4
        write_instancevar_slots         35.6    36.1    27.3    26.6    25.7   25.8
    
    Data structure read access:
        read_list                       24.2    24.5    20.8    20.8    19.0   19.5
        read_deque                      24.7    25.5    20.2    20.6    19.8   20.2
        read_dict                       24.3    25.7    22.3    23.0    21.0   22.4
        read_strdict                    22.6    24.3    19.5    21.2    18.9   21.5
    
    Data structure write access:
        write_list                      27.1    28.5    22.5    21.6    20.0   20.0
        write_deque                     28.7    30.1    22.7    21.8    23.5   21.7
        write_dict                      31.4    33.3    29.3    29.2    24.7   25.4
        write_strdict                   28.4    29.9    27.5    25.2    23.1   24.5
    
    Stack (or queue) operations:
        list_append_pop                 93.4   112.7    75.4    74.2    50.8   50.6
        deque_append_pop                43.5    57.0    49.4    49.2    42.5   44.2
        deque_append_popleft            43.7    57.3    49.7    49.7    42.8   46.4
    
    Timing loop:
        loop_overhead                    0.5     0.6     0.4     0.3     0.3    0.3
    
    78, tùy chọn dòng lệnh
    Python version                       3.4     3.5     3.6     3.7     3.8    3.9
    --------------                       ---     ---     ---     ---     ---    ---
    
    Variable and attribute read access:
        read_local                       7.1     7.1     5.4     5.1     3.9    3.9
        read_nonlocal                    7.1     8.1     5.8     5.4     4.4    4.5
        read_global                     15.5    19.0    14.3    13.6     7.6    7.8
        read_builtin                    21.1    21.6    18.5    19.0     7.5    7.8
        read_classvar_from_class        25.6    26.5    20.7    19.5    18.4   17.9
        read_classvar_from_instance     22.8    23.5    18.8    17.1    16.4   16.9
        read_instancevar                32.4    33.1    28.0    26.3    25.4   25.3
        read_instancevar_slots          27.8    31.3    20.8    20.8    20.2   20.5
        read_namedtuple                 73.8    57.5    45.0    46.8    18.4   18.7
        read_boundmethod                37.6    37.9    29.6    26.9    27.7   41.1
    
    Variable and attribute write access:
        write_local                      8.7     9.3     5.5     5.3     4.3    4.3
        write_nonlocal                  10.5    11.1     5.6     5.5     4.7    4.8
        write_global                    19.7    21.2    18.0    18.0    15.8   16.7
        write_classvar                  92.9    96.0   104.6   102.1    39.2   39.8
        write_instancevar               44.6    45.8    40.0    38.9    35.5   37.4
        write_instancevar_slots         35.6    36.1    27.3    26.6    25.7   25.8
    
    Data structure read access:
        read_list                       24.2    24.5    20.8    20.8    19.0   19.5
        read_deque                      24.7    25.5    20.2    20.6    19.8   20.2
        read_dict                       24.3    25.7    22.3    23.0    21.0   22.4
        read_strdict                    22.6    24.3    19.5    21.2    18.9   21.5
    
    Data structure write access:
        write_list                      27.1    28.5    22.5    21.6    20.0   20.0
        write_deque                     28.7    30.1    22.7    21.8    23.5   21.7
        write_dict                      31.4    33.3    29.3    29.2    24.7   25.4
        write_strdict                   28.4    29.9    27.5    25.2    23.1   24.5
    
    Stack (or queue) operations:
        list_append_pop                 93.4   112.7    75.4    74.2    50.8   50.6
        deque_append_pop                43.5    57.0    49.4    49.2    42.5   44.2
        deque_append_popleft            43.7    57.3    49.7    49.7    42.8   46.4
    
    Timing loop:
        loop_overhead                    0.5     0.6     0.4     0.3     0.3    0.3
    
    79 và trường
    Python version                       3.4     3.5     3.6     3.7     3.8    3.9
    --------------                       ---     ---     ---     ---     ---    ---
    
    Variable and attribute read access:
        read_local                       7.1     7.1     5.4     5.1     3.9    3.9
        read_nonlocal                    7.1     8.1     5.8     5.4     4.4    4.5
        read_global                     15.5    19.0    14.3    13.6     7.6    7.8
        read_builtin                    21.1    21.6    18.5    19.0     7.5    7.8
        read_classvar_from_class        25.6    26.5    20.7    19.5    18.4   17.9
        read_classvar_from_instance     22.8    23.5    18.8    17.1    16.4   16.9
        read_instancevar                32.4    33.1    28.0    26.3    25.4   25.3
        read_instancevar_slots          27.8    31.3    20.8    20.8    20.2   20.5
        read_namedtuple                 73.8    57.5    45.0    46.8    18.4   18.7
        read_boundmethod                37.6    37.9    29.6    26.9    27.7   41.1
    
    Variable and attribute write access:
        write_local                      8.7     9.3     5.5     5.3     4.3    4.3
        write_nonlocal                  10.5    11.1     5.6     5.5     4.7    4.8
        write_global                    19.7    21.2    18.0    18.0    15.8   16.7
        write_classvar                  92.9    96.0   104.6   102.1    39.2   39.8
        write_instancevar               44.6    45.8    40.0    38.9    35.5   37.4
        write_instancevar_slots         35.6    36.1    27.3    26.6    25.7   25.8
    
    Data structure read access:
        read_list                       24.2    24.5    20.8    20.8    19.0   19.5
        read_deque                      24.7    25.5    20.2    20.6    19.8   20.2
        read_dict                       24.3    25.7    22.3    23.0    21.0   22.4
        read_strdict                    22.6    24.3    19.5    21.2    18.9   21.5
    
    Data structure write access:
        write_list                      27.1    28.5    22.5    21.6    20.0   20.0
        write_deque                     28.7    30.1    22.7    21.8    23.5   21.7
        write_dict                      31.4    33.3    29.3    29.2    24.7   25.4
        write_strdict                   28.4    29.9    27.5    25.2    23.1   24.5
    
    Stack (or queue) operations:
        list_append_pop                 93.4   112.7    75.4    74.2    50.8   50.6
        deque_append_pop                43.5    57.0    49.4    49.2    42.5   44.2
        deque_append_popleft            43.7    57.3    49.7    49.7    42.8   46.4
    
    Timing loop:
        loop_overhead                    0.5     0.6     0.4     0.3     0.3    0.3
    
    80 của cấu trúc C
    Python version                       3.4     3.5     3.6     3.7     3.8    3.9
    --------------                       ---     ---     ---     ---     ---    ---
    
    Variable and attribute read access:
        read_local                       7.1     7.1     5.4     5.1     3.9    3.9
        read_nonlocal                    7.1     8.1     5.8     5.4     4.4    4.5
        read_global                     15.5    19.0    14.3    13.6     7.6    7.8
        read_builtin                    21.1    21.6    18.5    19.0     7.5    7.8
        read_classvar_from_class        25.6    26.5    20.7    19.5    18.4   17.9
        read_classvar_from_instance     22.8    23.5    18.8    17.1    16.4   16.9
        read_instancevar                32.4    33.1    28.0    26.3    25.4   25.3
        read_instancevar_slots          27.8    31.3    20.8    20.8    20.2   20.5
        read_namedtuple                 73.8    57.5    45.0    46.8    18.4   18.7
        read_boundmethod                37.6    37.9    29.6    26.9    27.7   41.1
    
    Variable and attribute write access:
        write_local                      8.7     9.3     5.5     5.3     4.3    4.3
        write_nonlocal                  10.5    11.1     5.6     5.5     4.7    4.8
        write_global                    19.7    21.2    18.0    18.0    15.8   16.7
        write_classvar                  92.9    96.0   104.6   102.1    39.2   39.8
        write_instancevar               44.6    45.8    40.0    38.9    35.5   37.4
        write_instancevar_slots         35.6    36.1    27.3    26.6    25.7   25.8
    
    Data structure read access:
        read_list                       24.2    24.5    20.8    20.8    19.0   19.5
        read_deque                      24.7    25.5    20.2    20.6    19.8   20.2
        read_dict                       24.3    25.7    22.3    23.0    21.0   22.4
        read_strdict                    22.6    24.3    19.5    21.2    18.9   21.5
    
    Data structure write access:
        write_list                      27.1    28.5    22.5    21.6    20.0   20.0
        write_deque                     28.7    30.1    22.7    21.8    23.5   21.7
        write_dict                      31.4    33.3    29.3    29.2    24.7   25.4
        write_strdict                   28.4    29.9    27.5    25.2    23.1   24.5
    
    Stack (or queue) operations:
        list_append_pop                 93.4   112.7    75.4    74.2    50.8   50.6
        deque_append_pop                43.5    57.0    49.4    49.2    42.5   44.2
        deque_append_popleft            43.7    57.3    49.7    49.7    42.8   46.4
    
    Timing loop:
        loop_overhead                    0.5     0.6     0.4     0.3     0.3    0.3
    
    81 đã bị xóa. Họ yêu cầu một bản dựng Python đặc biệt bằng cách xác định macro
    Python version                       3.4     3.5     3.6     3.7     3.8    3.9
    --------------                       ---     ---     ---     ---     ---    ---
    
    Variable and attribute read access:
        read_local                       7.1     7.1     5.4     5.1     3.9    3.9
        read_nonlocal                    7.1     8.1     5.8     5.4     4.4    4.5
        read_global                     15.5    19.0    14.3    13.6     7.6    7.8
        read_builtin                    21.1    21.6    18.5    19.0     7.5    7.8
        read_classvar_from_class        25.6    26.5    20.7    19.5    18.4   17.9
        read_classvar_from_instance     22.8    23.5    18.8    17.1    16.4   16.9
        read_instancevar                32.4    33.1    28.0    26.3    25.4   25.3
        read_instancevar_slots          27.8    31.3    20.8    20.8    20.2   20.5
        read_namedtuple                 73.8    57.5    45.0    46.8    18.4   18.7
        read_boundmethod                37.6    37.9    29.6    26.9    27.7   41.1
    
    Variable and attribute write access:
        write_local                      8.7     9.3     5.5     5.3     4.3    4.3
        write_nonlocal                  10.5    11.1     5.6     5.5     4.7    4.8
        write_global                    19.7    21.2    18.0    18.0    15.8   16.7
        write_classvar                  92.9    96.0   104.6   102.1    39.2   39.8
        write_instancevar               44.6    45.8    40.0    38.9    35.5   37.4
        write_instancevar_slots         35.6    36.1    27.3    26.6    25.7   25.8
    
    Data structure read access:
        read_list                       24.2    24.5    20.8    20.8    19.0   19.5
        read_deque                      24.7    25.5    20.2    20.6    19.8   20.2
        read_dict                       24.3    25.7    22.3    23.0    21.0   22.4
        read_strdict                    22.6    24.3    19.5    21.2    18.9   21.5
    
    Data structure write access:
        write_list                      27.1    28.5    22.5    21.6    20.0   20.0
        write_deque                     28.7    30.1    22.7    21.8    23.5   21.7
        write_dict                      31.4    33.3    29.3    29.2    24.7   25.4
        write_strdict                   28.4    29.9    27.5    25.2    23.1   24.5
    
    Stack (or queue) operations:
        list_append_pop                 93.4   112.7    75.4    74.2    50.8   50.6
        deque_append_pop                43.5    57.0    49.4    49.2    42.5   44.2
        deque_append_popleft            43.7    57.3    49.7    49.7    42.8   46.4
    
    Timing loop:
        loop_overhead                    0.5     0.6     0.4     0.3     0.3    0.3
    
    82. (Được đóng góp bởi Victor Stinner trong BPO-39489.)

  • Thuộc tính

    Python version                       3.4     3.5     3.6     3.7     3.8    3.9
    --------------                       ---     ---     ---     ---     ---    ---
    
    Variable and attribute read access:
        read_local                       7.1     7.1     5.4     5.1     3.9    3.9
        read_nonlocal                    7.1     8.1     5.8     5.4     4.4    4.5
        read_global                     15.5    19.0    14.3    13.6     7.6    7.8
        read_builtin                    21.1    21.6    18.5    19.0     7.5    7.8
        read_classvar_from_class        25.6    26.5    20.7    19.5    18.4   17.9
        read_classvar_from_instance     22.8    23.5    18.8    17.1    16.4   16.9
        read_instancevar                32.4    33.1    28.0    26.3    25.4   25.3
        read_instancevar_slots          27.8    31.3    20.8    20.8    20.2   20.5
        read_namedtuple                 73.8    57.5    45.0    46.8    18.4   18.7
        read_boundmethod                37.6    37.9    29.6    26.9    27.7   41.1
    
    Variable and attribute write access:
        write_local                      8.7     9.3     5.5     5.3     4.3    4.3
        write_nonlocal                  10.5    11.1     5.6     5.5     4.7    4.8
        write_global                    19.7    21.2    18.0    18.0    15.8   16.7
        write_classvar                  92.9    96.0   104.6   102.1    39.2   39.8
        write_instancevar               44.6    45.8    40.0    38.9    35.5   37.4
        write_instancevar_slots         35.6    36.1    27.3    26.6    25.7   25.8
    
    Data structure read access:
        read_list                       24.2    24.5    20.8    20.8    19.0   19.5
        read_deque                      24.7    25.5    20.2    20.6    19.8   20.2
        read_dict                       24.3    25.7    22.3    23.0    21.0   22.4
        read_strdict                    22.6    24.3    19.5    21.2    18.9   21.5
    
    Data structure write access:
        write_list                      27.1    28.5    22.5    21.6    20.0   20.0
        write_deque                     28.7    30.1    22.7    21.8    23.5   21.7
        write_dict                      31.4    33.3    29.3    29.2    24.7   25.4
        write_strdict                   28.4    29.9    27.5    25.2    23.1   24.5
    
    Stack (or queue) operations:
        list_append_pop                 93.4   112.7    75.4    74.2    50.8   50.6
        deque_append_pop                43.5    57.0    49.4    49.2    42.5   44.2
        deque_append_popleft            43.7    57.3    49.7    49.7    42.8   46.4
    
    Timing loop:
        loop_overhead                    0.5     0.6     0.4     0.3     0.3    0.3
    
    83 của lớp
    Python version                       3.4     3.5     3.6     3.7     3.8    3.9
    --------------                       ---     ---     ---     ---     ---    ---
    
    Variable and attribute read access:
        read_local                       7.1     7.1     5.4     5.1     3.9    3.9
        read_nonlocal                    7.1     8.1     5.8     5.4     4.4    4.5
        read_global                     15.5    19.0    14.3    13.6     7.6    7.8
        read_builtin                    21.1    21.6    18.5    19.0     7.5    7.8
        read_classvar_from_class        25.6    26.5    20.7    19.5    18.4   17.9
        read_classvar_from_instance     22.8    23.5    18.8    17.1    16.4   16.9
        read_instancevar                32.4    33.1    28.0    26.3    25.4   25.3
        read_instancevar_slots          27.8    31.3    20.8    20.8    20.2   20.5
        read_namedtuple                 73.8    57.5    45.0    46.8    18.4   18.7
        read_boundmethod                37.6    37.9    29.6    26.9    27.7   41.1
    
    Variable and attribute write access:
        write_local                      8.7     9.3     5.5     5.3     4.3    4.3
        write_nonlocal                  10.5    11.1     5.6     5.5     4.7    4.8
        write_global                    19.7    21.2    18.0    18.0    15.8   16.7
        write_classvar                  92.9    96.0   104.6   102.1    39.2   39.8
        write_instancevar               44.6    45.8    40.0    38.9    35.5   37.4
        write_instancevar_slots         35.6    36.1    27.3    26.6    25.7   25.8
    
    Data structure read access:
        read_list                       24.2    24.5    20.8    20.8    19.0   19.5
        read_deque                      24.7    25.5    20.2    20.6    19.8   20.2
        read_dict                       24.3    25.7    22.3    23.0    21.0   22.4
        read_strdict                    22.6    24.3    19.5    21.2    18.9   21.5
    
    Data structure write access:
        write_list                      27.1    28.5    22.5    21.6    20.0   20.0
        write_deque                     28.7    30.1    22.7    21.8    23.5   21.7
        write_dict                      31.4    33.3    29.3    29.2    24.7   25.4
        write_strdict                   28.4    29.9    27.5    25.2    23.1   24.5
    
    Stack (or queue) operations:
        list_append_pop                 93.4   112.7    75.4    74.2    50.8   50.6
        deque_append_pop                43.5    57.0    49.4    49.2    42.5   44.2
        deque_append_popleft            43.7    57.3    49.7    49.7    42.8   46.4
    
    Timing loop:
        loop_overhead                    0.5     0.6     0.4     0.3     0.3    0.3
    
    84 đã bị xóa. Nó đã không được chấp nhận kể từ Python 3,8. Sử dụng thuộc tính
    Python version                       3.4     3.5     3.6     3.7     3.8    3.9
    --------------                       ---     ---     ---     ---     ---    ---
    
    Variable and attribute read access:
        read_local                       7.1     7.1     5.4     5.1     3.9    3.9
        read_nonlocal                    7.1     8.1     5.8     5.4     4.4    4.5
        read_global                     15.5    19.0    14.3    13.6     7.6    7.8
        read_builtin                    21.1    21.6    18.5    19.0     7.5    7.8
        read_classvar_from_class        25.6    26.5    20.7    19.5    18.4   17.9
        read_classvar_from_instance     22.8    23.5    18.8    17.1    16.4   16.9
        read_instancevar                32.4    33.1    28.0    26.3    25.4   25.3
        read_instancevar_slots          27.8    31.3    20.8    20.8    20.2   20.5
        read_namedtuple                 73.8    57.5    45.0    46.8    18.4   18.7
        read_boundmethod                37.6    37.9    29.6    26.9    27.7   41.1
    
    Variable and attribute write access:
        write_local                      8.7     9.3     5.5     5.3     4.3    4.3
        write_nonlocal                  10.5    11.1     5.6     5.5     4.7    4.8
        write_global                    19.7    21.2    18.0    18.0    15.8   16.7
        write_classvar                  92.9    96.0   104.6   102.1    39.2   39.8
        write_instancevar               44.6    45.8    40.0    38.9    35.5   37.4
        write_instancevar_slots         35.6    36.1    27.3    26.6    25.7   25.8
    
    Data structure read access:
        read_list                       24.2    24.5    20.8    20.8    19.0   19.5
        read_deque                      24.7    25.5    20.2    20.6    19.8   20.2
        read_dict                       24.3    25.7    22.3    23.0    21.0   22.4
        read_strdict                    22.6    24.3    19.5    21.2    18.9   21.5
    
    Data structure write access:
        write_list                      27.1    28.5    22.5    21.6    20.0   20.0
        write_deque                     28.7    30.1    22.7    21.8    23.5   21.7
        write_dict                      31.4    33.3    29.3    29.2    24.7   25.4
        write_strdict                   28.4    29.9    27.5    25.2    23.1   24.5
    
    Stack (or queue) operations:
        list_append_pop                 93.4   112.7    75.4    74.2    50.8   50.6
        deque_append_pop                43.5    57.0    49.4    49.2    42.5   44.2
        deque_append_popleft            43.7    57.3    49.7    49.7    42.8   46.4
    
    Timing loop:
        loop_overhead                    0.5     0.6     0.4     0.3     0.3    0.3
    
    85 thay thế. (Được đóng góp bởi Serhiy Storchaka trong BPO-40182.)

  • Phương pháp

    Python version                       3.4     3.5     3.6     3.7     3.8    3.9
    --------------                       ---     ---     ---     ---     ---    ---
    
    Variable and attribute read access:
        read_local                       7.1     7.1     5.4     5.1     3.9    3.9
        read_nonlocal                    7.1     8.1     5.8     5.4     4.4    4.5
        read_global                     15.5    19.0    14.3    13.6     7.6    7.8
        read_builtin                    21.1    21.6    18.5    19.0     7.5    7.8
        read_classvar_from_class        25.6    26.5    20.7    19.5    18.4   17.9
        read_classvar_from_instance     22.8    23.5    18.8    17.1    16.4   16.9
        read_instancevar                32.4    33.1    28.0    26.3    25.4   25.3
        read_instancevar_slots          27.8    31.3    20.8    20.8    20.2   20.5
        read_namedtuple                 73.8    57.5    45.0    46.8    18.4   18.7
        read_boundmethod                37.6    37.9    29.6    26.9    27.7   41.1
    
    Variable and attribute write access:
        write_local                      8.7     9.3     5.5     5.3     4.3    4.3
        write_nonlocal                  10.5    11.1     5.6     5.5     4.7    4.8
        write_global                    19.7    21.2    18.0    18.0    15.8   16.7
        write_classvar                  92.9    96.0   104.6   102.1    39.2   39.8
        write_instancevar               44.6    45.8    40.0    38.9    35.5   37.4
        write_instancevar_slots         35.6    36.1    27.3    26.6    25.7   25.8
    
    Data structure read access:
        read_list                       24.2    24.5    20.8    20.8    19.0   19.5
        read_deque                      24.7    25.5    20.2    20.6    19.8   20.2
        read_dict                       24.3    25.7    22.3    23.0    21.0   22.4
        read_strdict                    22.6    24.3    19.5    21.2    18.9   21.5
    
    Data structure write access:
        write_list                      27.1    28.5    22.5    21.6    20.0   20.0
        write_deque                     28.7    30.1    22.7    21.8    23.5   21.7
        write_dict                      31.4    33.3    29.3    29.2    24.7   25.4
        write_strdict                   28.4    29.9    27.5    25.2    23.1   24.5
    
    Stack (or queue) operations:
        list_append_pop                 93.4   112.7    75.4    74.2    50.8   50.6
        deque_append_pop                43.5    57.0    49.4    49.2    42.5   44.2
        deque_append_popleft            43.7    57.3    49.7    49.7    42.8   46.4
    
    Timing loop:
        loop_overhead                    0.5     0.6     0.4     0.3     0.3    0.3
    
    86 đã được loại bỏ. Nó không được dùng từ năm 2006 và chỉ trả lại
    Python version                       3.4     3.5     3.6     3.7     3.8    3.9
    --------------                       ---     ---     ---     ---     ---    ---
    
    Variable and attribute read access:
        read_local                       7.1     7.1     5.4     5.1     3.9    3.9
        read_nonlocal                    7.1     8.1     5.8     5.4     4.4    4.5
        read_global                     15.5    19.0    14.3    13.6     7.6    7.8
        read_builtin                    21.1    21.6    18.5    19.0     7.5    7.8
        read_classvar_from_class        25.6    26.5    20.7    19.5    18.4   17.9
        read_classvar_from_instance     22.8    23.5    18.8    17.1    16.4   16.9
        read_instancevar                32.4    33.1    28.0    26.3    25.4   25.3
        read_instancevar_slots          27.8    31.3    20.8    20.8    20.2   20.5
        read_namedtuple                 73.8    57.5    45.0    46.8    18.4   18.7
        read_boundmethod                37.6    37.9    29.6    26.9    27.7   41.1
    
    Variable and attribute write access:
        write_local                      8.7     9.3     5.5     5.3     4.3    4.3
        write_nonlocal                  10.5    11.1     5.6     5.5     4.7    4.8
        write_global                    19.7    21.2    18.0    18.0    15.8   16.7
        write_classvar                  92.9    96.0   104.6   102.1    39.2   39.8
        write_instancevar               44.6    45.8    40.0    38.9    35.5   37.4
        write_instancevar_slots         35.6    36.1    27.3    26.6    25.7   25.8
    
    Data structure read access:
        read_list                       24.2    24.5    20.8    20.8    19.0   19.5
        read_deque                      24.7    25.5    20.2    20.6    19.8   20.2
        read_dict                       24.3    25.7    22.3    23.0    21.0   22.4
        read_strdict                    22.6    24.3    19.5    21.2    18.9   21.5
    
    Data structure write access:
        write_list                      27.1    28.5    22.5    21.6    20.0   20.0
        write_deque                     28.7    30.1    22.7    21.8    23.5   21.7
        write_dict                      31.4    33.3    29.3    29.2    24.7   25.4
        write_strdict                   28.4    29.9    27.5    25.2    23.1   24.5
    
    Stack (or queue) operations:
        list_append_pop                 93.4   112.7    75.4    74.2    50.8   50.6
        deque_append_pop                43.5    57.0    49.4    49.2    42.5   44.2
        deque_append_popleft            43.7    57.3    49.7    49.7    42.8   46.4
    
    Timing loop:
        loop_overhead                    0.5     0.6     0.4     0.3     0.3    0.3
    
    87 khi nó được gọi. (Được đóng góp bởi Batuhan Taskaya trong BPO-40208)

  • Python version                       3.4     3.5     3.6     3.7     3.8    3.9
    --------------                       ---     ---     ---     ---     ---    ---
    
    Variable and attribute read access:
        read_local                       7.1     7.1     5.4     5.1     3.9    3.9
        read_nonlocal                    7.1     8.1     5.8     5.4     4.4    4.5
        read_global                     15.5    19.0    14.3    13.6     7.6    7.8
        read_builtin                    21.1    21.6    18.5    19.0     7.5    7.8
        read_classvar_from_class        25.6    26.5    20.7    19.5    18.4   17.9
        read_classvar_from_instance     22.8    23.5    18.8    17.1    16.4   16.9
        read_instancevar                32.4    33.1    28.0    26.3    25.4   25.3
        read_instancevar_slots          27.8    31.3    20.8    20.8    20.2   20.5
        read_namedtuple                 73.8    57.5    45.0    46.8    18.4   18.7
        read_boundmethod                37.6    37.9    29.6    26.9    27.7   41.1
    
    Variable and attribute write access:
        write_local                      8.7     9.3     5.5     5.3     4.3    4.3
        write_nonlocal                  10.5    11.1     5.6     5.5     4.7    4.8
        write_global                    19.7    21.2    18.0    18.0    15.8   16.7
        write_classvar                  92.9    96.0   104.6   102.1    39.2   39.8
        write_instancevar               44.6    45.8    40.0    38.9    35.5   37.4
        write_instancevar_slots         35.6    36.1    27.3    26.6    25.7   25.8
    
    Data structure read access:
        read_list                       24.2    24.5    20.8    20.8    19.0   19.5
        read_deque                      24.7    25.5    20.2    20.6    19.8   20.2
        read_dict                       24.3    25.7    22.3    23.0    21.0   22.4
        read_strdict                    22.6    24.3    19.5    21.2    18.9   21.5
    
    Data structure write access:
        write_list                      27.1    28.5    22.5    21.6    20.0   20.0
        write_deque                     28.7    30.1    22.7    21.8    23.5   21.7
        write_dict                      31.4    33.3    29.3    29.2    24.7   25.4
        write_strdict                   28.4    29.9    27.5    25.2    23.1   24.5
    
    Stack (or queue) operations:
        list_append_pop                 93.4   112.7    75.4    74.2    50.8   50.6
        deque_append_pop                43.5    57.0    49.4    49.2    42.5   44.2
        deque_append_popleft            43.7    57.3    49.7    49.7    42.8   46.4
    
    Timing loop:
        loop_overhead                    0.5     0.6     0.4     0.3     0.3    0.3
    
    88 và
    Python version                       3.4     3.5     3.6     3.7     3.8    3.9
    --------------                       ---     ---     ---     ---     ---    ---
    
    Variable and attribute read access:
        read_local                       7.1     7.1     5.4     5.1     3.9    3.9
        read_nonlocal                    7.1     8.1     5.8     5.4     4.4    4.5
        read_global                     15.5    19.0    14.3    13.6     7.6    7.8
        read_builtin                    21.1    21.6    18.5    19.0     7.5    7.8
        read_classvar_from_class        25.6    26.5    20.7    19.5    18.4   17.9
        read_classvar_from_instance     22.8    23.5    18.8    17.1    16.4   16.9
        read_instancevar                32.4    33.1    28.0    26.3    25.4   25.3
        read_instancevar_slots          27.8    31.3    20.8    20.8    20.2   20.5
        read_namedtuple                 73.8    57.5    45.0    46.8    18.4   18.7
        read_boundmethod                37.6    37.9    29.6    26.9    27.7   41.1
    
    Variable and attribute write access:
        write_local                      8.7     9.3     5.5     5.3     4.3    4.3
        write_nonlocal                  10.5    11.1     5.6     5.5     4.7    4.8
        write_global                    19.7    21.2    18.0    18.0    15.8   16.7
        write_classvar                  92.9    96.0   104.6   102.1    39.2   39.8
        write_instancevar               44.6    45.8    40.0    38.9    35.5   37.4
        write_instancevar_slots         35.6    36.1    27.3    26.6    25.7   25.8
    
    Data structure read access:
        read_list                       24.2    24.5    20.8    20.8    19.0   19.5
        read_deque                      24.7    25.5    20.2    20.6    19.8   20.2
        read_dict                       24.3    25.7    22.3    23.0    21.0   22.4
        read_strdict                    22.6    24.3    19.5    21.2    18.9   21.5
    
    Data structure write access:
        write_list                      27.1    28.5    22.5    21.6    20.0   20.0
        write_deque                     28.7    30.1    22.7    21.8    23.5   21.7
        write_dict                      31.4    33.3    29.3    29.2    24.7   25.4
        write_strdict                   28.4    29.9    27.5    25.2    23.1   24.5
    
    Stack (or queue) operations:
        list_append_pop                 93.4   112.7    75.4    74.2    50.8   50.6
        deque_append_pop                43.5    57.0    49.4    49.2    42.5   44.2
        deque_append_popleft            43.7    57.3    49.7    49.7    42.8   46.4
    
    Timing loop:
        loop_overhead                    0.5     0.6     0.4     0.3     0.3    0.3
    
    89 đã được gỡ bỏ. Chúng không được dùng từ Python 3.7 và bạn có thể sử dụng
    Python version                       3.4     3.5     3.6     3.7     3.8    3.9
    --------------                       ---     ---     ---     ---     ---    ---
    
    Variable and attribute read access:
        read_local                       7.1     7.1     5.4     5.1     3.9    3.9
        read_nonlocal                    7.1     8.1     5.8     5.4     4.4    4.5
        read_global                     15.5    19.0    14.3    13.6     7.6    7.8
        read_builtin                    21.1    21.6    18.5    19.0     7.5    7.8
        read_classvar_from_class        25.6    26.5    20.7    19.5    18.4   17.9
        read_classvar_from_instance     22.8    23.5    18.8    17.1    16.4   16.9
        read_instancevar                32.4    33.1    28.0    26.3    25.4   25.3
        read_instancevar_slots          27.8    31.3    20.8    20.8    20.2   20.5
        read_namedtuple                 73.8    57.5    45.0    46.8    18.4   18.7
        read_boundmethod                37.6    37.9    29.6    26.9    27.7   41.1
    
    Variable and attribute write access:
        write_local                      8.7     9.3     5.5     5.3     4.3    4.3
        write_nonlocal                  10.5    11.1     5.6     5.5     4.7    4.8
        write_global                    19.7    21.2    18.0    18.0    15.8   16.7
        write_classvar                  92.9    96.0   104.6   102.1    39.2   39.8
        write_instancevar               44.6    45.8    40.0    38.9    35.5   37.4
        write_instancevar_slots         35.6    36.1    27.3    26.6    25.7   25.8
    
    Data structure read access:
        read_list                       24.2    24.5    20.8    20.8    19.0   19.5
        read_deque                      24.7    25.5    20.2    20.6    19.8   20.2
        read_dict                       24.3    25.7    22.3    23.0    21.0   22.4
        read_strdict                    22.6    24.3    19.5    21.2    18.9   21.5
    
    Data structure write access:
        write_list                      27.1    28.5    22.5    21.6    20.0   20.0
        write_deque                     28.7    30.1    22.7    21.8    23.5   21.7
        write_dict                      31.4    33.3    29.3    29.2    24.7   25.4
        write_strdict                   28.4    29.9    27.5    25.2    23.1   24.5
    
    Stack (or queue) operations:
        list_append_pop                 93.4   112.7    75.4    74.2    50.8   50.6
        deque_append_pop                43.5    57.0    49.4    49.2    42.5   44.2
        deque_append_popleft            43.7    57.3    49.7    49.7    42.8   46.4
    
    Timing loop:
        loop_overhead                    0.5     0.6     0.4     0.3     0.3    0.3
    
    90 và
    Python version                       3.4     3.5     3.6     3.7     3.8    3.9
    --------------                       ---     ---     ---     ---     ---    ---
    
    Variable and attribute read access:
        read_local                       7.1     7.1     5.4     5.1     3.9    3.9
        read_nonlocal                    7.1     8.1     5.8     5.4     4.4    4.5
        read_global                     15.5    19.0    14.3    13.6     7.6    7.8
        read_builtin                    21.1    21.6    18.5    19.0     7.5    7.8
        read_classvar_from_class        25.6    26.5    20.7    19.5    18.4   17.9
        read_classvar_from_instance     22.8    23.5    18.8    17.1    16.4   16.9
        read_instancevar                32.4    33.1    28.0    26.3    25.4   25.3
        read_instancevar_slots          27.8    31.3    20.8    20.8    20.2   20.5
        read_namedtuple                 73.8    57.5    45.0    46.8    18.4   18.7
        read_boundmethod                37.6    37.9    29.6    26.9    27.7   41.1
    
    Variable and attribute write access:
        write_local                      8.7     9.3     5.5     5.3     4.3    4.3
        write_nonlocal                  10.5    11.1     5.6     5.5     4.7    4.8
        write_global                    19.7    21.2    18.0    18.0    15.8   16.7
        write_classvar                  92.9    96.0   104.6   102.1    39.2   39.8
        write_instancevar               44.6    45.8    40.0    38.9    35.5   37.4
        write_instancevar_slots         35.6    36.1    27.3    26.6    25.7   25.8
    
    Data structure read access:
        read_list                       24.2    24.5    20.8    20.8    19.0   19.5
        read_deque                      24.7    25.5    20.2    20.6    19.8   20.2
        read_dict                       24.3    25.7    22.3    23.0    21.0   22.4
        read_strdict                    22.6    24.3    19.5    21.2    18.9   21.5
    
    Data structure write access:
        write_list                      27.1    28.5    22.5    21.6    20.0   20.0
        write_deque                     28.7    30.1    22.7    21.8    23.5   21.7
        write_dict                      31.4    33.3    29.3    29.2    24.7   25.4
        write_strdict                   28.4    29.9    27.5    25.2    23.1   24.5
    
    Stack (or queue) operations:
        list_append_pop                 93.4   112.7    75.4    74.2    50.8   50.6
        deque_append_pop                43.5    57.0    49.4    49.2    42.5   44.2
        deque_append_popleft            43.7    57.3    49.7    49.7    42.8   46.4
    
    Timing loop:
        loop_overhead                    0.5     0.6     0.4     0.3     0.3    0.3
    
    91 thay thế. (Được đóng góp bởi Rémi Lapeyre trong BPO-40967)

  • Phương pháp

    Python version                       3.4     3.5     3.6     3.7     3.8    3.9
    --------------                       ---     ---     ---     ---     ---    ---
    
    Variable and attribute read access:
        read_local                       7.1     7.1     5.4     5.1     3.9    3.9
        read_nonlocal                    7.1     8.1     5.8     5.4     4.4    4.5
        read_global                     15.5    19.0    14.3    13.6     7.6    7.8
        read_builtin                    21.1    21.6    18.5    19.0     7.5    7.8
        read_classvar_from_class        25.6    26.5    20.7    19.5    18.4   17.9
        read_classvar_from_instance     22.8    23.5    18.8    17.1    16.4   16.9
        read_instancevar                32.4    33.1    28.0    26.3    25.4   25.3
        read_instancevar_slots          27.8    31.3    20.8    20.8    20.2   20.5
        read_namedtuple                 73.8    57.5    45.0    46.8    18.4   18.7
        read_boundmethod                37.6    37.9    29.6    26.9    27.7   41.1
    
    Variable and attribute write access:
        write_local                      8.7     9.3     5.5     5.3     4.3    4.3
        write_nonlocal                  10.5    11.1     5.6     5.5     4.7    4.8
        write_global                    19.7    21.2    18.0    18.0    15.8   16.7
        write_classvar                  92.9    96.0   104.6   102.1    39.2   39.8
        write_instancevar               44.6    45.8    40.0    38.9    35.5   37.4
        write_instancevar_slots         35.6    36.1    27.3    26.6    25.7   25.8
    
    Data structure read access:
        read_list                       24.2    24.5    20.8    20.8    19.0   19.5
        read_deque                      24.7    25.5    20.2    20.6    19.8   20.2
        read_dict                       24.3    25.7    22.3    23.0    21.0   22.4
        read_strdict                    22.6    24.3    19.5    21.2    18.9   21.5
    
    Data structure write access:
        write_list                      27.1    28.5    22.5    21.6    20.0   20.0
        write_deque                     28.7    30.1    22.7    21.8    23.5   21.7
        write_dict                      31.4    33.3    29.3    29.2    24.7   25.4
        write_strdict                   28.4    29.9    27.5    25.2    23.1   24.5
    
    Stack (or queue) operations:
        list_append_pop                 93.4   112.7    75.4    74.2    50.8   50.6
        deque_append_pop                43.5    57.0    49.4    49.2    42.5   44.2
        deque_append_popleft            43.7    57.3    49.7    49.7    42.8   46.4
    
    Timing loop:
        loop_overhead                    0.5     0.6     0.4     0.3     0.3    0.3
    
    92 trong lớp
    Python version                       3.4     3.5     3.6     3.7     3.8    3.9
    --------------                       ---     ---     ---     ---     ---    ---
    
    Variable and attribute read access:
        read_local                       7.1     7.1     5.4     5.1     3.9    3.9
        read_nonlocal                    7.1     8.1     5.8     5.4     4.4    4.5
        read_global                     15.5    19.0    14.3    13.6     7.6    7.8
        read_builtin                    21.1    21.6    18.5    19.0     7.5    7.8
        read_classvar_from_class        25.6    26.5    20.7    19.5    18.4   17.9
        read_classvar_from_instance     22.8    23.5    18.8    17.1    16.4   16.9
        read_instancevar                32.4    33.1    28.0    26.3    25.4   25.3
        read_instancevar_slots          27.8    31.3    20.8    20.8    20.2   20.5
        read_namedtuple                 73.8    57.5    45.0    46.8    18.4   18.7
        read_boundmethod                37.6    37.9    29.6    26.9    27.7   41.1
    
    Variable and attribute write access:
        write_local                      8.7     9.3     5.5     5.3     4.3    4.3
        write_nonlocal                  10.5    11.1     5.6     5.5     4.7    4.8
        write_global                    19.7    21.2    18.0    18.0    15.8   16.7
        write_classvar                  92.9    96.0   104.6   102.1    39.2   39.8
        write_instancevar               44.6    45.8    40.0    38.9    35.5   37.4
        write_instancevar_slots         35.6    36.1    27.3    26.6    25.7   25.8
    
    Data structure read access:
        read_list                       24.2    24.5    20.8    20.8    19.0   19.5
        read_deque                      24.7    25.5    20.2    20.6    19.8   20.2
        read_dict                       24.3    25.7    22.3    23.0    21.0   22.4
        read_strdict                    22.6    24.3    19.5    21.2    18.9   21.5
    
    Data structure write access:
        write_list                      27.1    28.5    22.5    21.6    20.0   20.0
        write_deque                     28.7    30.1    22.7    21.8    23.5   21.7
        write_dict                      31.4    33.3    29.3    29.2    24.7   25.4
        write_strdict                   28.4    29.9    27.5    25.2    23.1   24.5
    
    Stack (or queue) operations:
        list_append_pop                 93.4   112.7    75.4    74.2    50.8   50.6
        deque_append_pop                43.5    57.0    49.4    49.2    42.5   44.2
        deque_append_popleft            43.7    57.3    49.7    49.7    42.8   46.4
    
    Timing loop:
        loop_overhead                    0.5     0.6     0.4     0.3     0.3    0.3
    
    93 đã bị xóa (nó không được dùng từ Python 3.4).
    Python version                       3.4     3.5     3.6     3.7     3.8    3.9
    --------------                       ---     ---     ---     ---     ---    ---
    
    Variable and attribute read access:
        read_local                       7.1     7.1     5.4     5.1     3.9    3.9
        read_nonlocal                    7.1     8.1     5.8     5.4     4.4    4.5
        read_global                     15.5    19.0    14.3    13.6     7.6    7.8
        read_builtin                    21.1    21.6    18.5    19.0     7.5    7.8
        read_classvar_from_class        25.6    26.5    20.7    19.5    18.4   17.9
        read_classvar_from_instance     22.8    23.5    18.8    17.1    16.4   16.9
        read_instancevar                32.4    33.1    28.0    26.3    25.4   25.3
        read_instancevar_slots          27.8    31.3    20.8    20.8    20.2   20.5
        read_namedtuple                 73.8    57.5    45.0    46.8    18.4   18.7
        read_boundmethod                37.6    37.9    29.6    26.9    27.7   41.1
    
    Variable and attribute write access:
        write_local                      8.7     9.3     5.5     5.3     4.3    4.3
        write_nonlocal                  10.5    11.1     5.6     5.5     4.7    4.8
        write_global                    19.7    21.2    18.0    18.0    15.8   16.7
        write_classvar                  92.9    96.0   104.6   102.1    39.2   39.8
        write_instancevar               44.6    45.8    40.0    38.9    35.5   37.4
        write_instancevar_slots         35.6    36.1    27.3    26.6    25.7   25.8
    
    Data structure read access:
        read_list                       24.2    24.5    20.8    20.8    19.0   19.5
        read_deque                      24.7    25.5    20.2    20.6    19.8   20.2
        read_dict                       24.3    25.7    22.3    23.0    21.0   22.4
        read_strdict                    22.6    24.3    19.5    21.2    18.9   21.5
    
    Data structure write access:
        write_list                      27.1    28.5    22.5    21.6    20.0   20.0
        write_deque                     28.7    30.1    22.7    21.8    23.5   21.7
        write_dict                      31.4    33.3    29.3    29.2    24.7   25.4
        write_strdict                   28.4    29.9    27.5    25.2    23.1   24.5
    
    Stack (or queue) operations:
        list_append_pop                 93.4   112.7    75.4    74.2    50.8   50.6
        deque_append_pop                43.5    57.0    49.4    49.2    42.5   44.2
        deque_append_popleft            43.7    57.3    49.7    49.7    42.8   46.4
    
    Timing loop:
        loop_overhead                    0.5     0.6     0.4     0.3     0.3    0.3
    
    94 nên được sử dụng để chuyển đổi các tham chiếu ký tự sang các ký tự unicode tương ứng.

Chuyển sang Python 3.9¶

Phần này liệt kê các thay đổi được mô tả trước đây và các lỗi khác có thể yêu cầu thay đổi mã của bạn.

Những thay đổi trong API Python

  • >>> from typing import Literal
    >>> Literal[{0}]
    >>> Literal[{0}] == Literal[{False}]
    Traceback (most recent call last):
      File "", line 1, in 
    TypeError: unhashable type: 'set'
    
    0 và
    def greet_all(names: list[str]) -> None:
        for name in names:
            print("Hello", name)
    
    69 hiện đang tăng
    >>> from typing import Literal
    >>> Literal[{0}]
    >>> Literal[{0}] == Literal[{False}]
    Traceback (most recent call last):
      File "", line 1, in 
    TypeError: unhashable type: 'set'
    
    1 nơi mà trước đây nó đã tăng
    >>> from typing import Literal
    >>> Literal[{0}]
    >>> Literal[{0}] == Literal[{False}]
    Traceback (most recent call last):
      File "", line 1, in 
    TypeError: unhashable type: 'set'
    
    2. Người gọi bắt loại ngoại lệ cụ thể và hỗ trợ cả Python 3.9 và các phiên bản trước sẽ cần bắt cả bằng cách sử dụng
    Python version                       3.4     3.5     3.6     3.7     3.8    3.9
    --------------                       ---     ---     ---     ---     ---    ---
    
    Variable and attribute read access:
        read_local                       7.1     7.1     5.4     5.1     3.9    3.9
        read_nonlocal                    7.1     8.1     5.8     5.4     4.4    4.5
        read_global                     15.5    19.0    14.3    13.6     7.6    7.8
        read_builtin                    21.1    21.6    18.5    19.0     7.5    7.8
        read_classvar_from_class        25.6    26.5    20.7    19.5    18.4   17.9
        read_classvar_from_instance     22.8    23.5    18.8    17.1    16.4   16.9
        read_instancevar                32.4    33.1    28.0    26.3    25.4   25.3
        read_instancevar_slots          27.8    31.3    20.8    20.8    20.2   20.5
        read_namedtuple                 73.8    57.5    45.0    46.8    18.4   18.7
        read_boundmethod                37.6    37.9    29.6    26.9    27.7   41.1
    
    Variable and attribute write access:
        write_local                      8.7     9.3     5.5     5.3     4.3    4.3
        write_nonlocal                  10.5    11.1     5.6     5.5     4.7    4.8
        write_global                    19.7    21.2    18.0    18.0    15.8   16.7
        write_classvar                  92.9    96.0   104.6   102.1    39.2   39.8
        write_instancevar               44.6    45.8    40.0    38.9    35.5   37.4
        write_instancevar_slots         35.6    36.1    27.3    26.6    25.7   25.8
    
    Data structure read access:
        read_list                       24.2    24.5    20.8    20.8    19.0   19.5
        read_deque                      24.7    25.5    20.2    20.6    19.8   20.2
        read_dict                       24.3    25.7    22.3    23.0    21.0   22.4
        read_strdict                    22.6    24.3    19.5    21.2    18.9   21.5
    
    Data structure write access:
        write_list                      27.1    28.5    22.5    21.6    20.0   20.0
        write_deque                     28.7    30.1    22.7    21.8    23.5   21.7
        write_dict                      31.4    33.3    29.3    29.2    24.7   25.4
        write_strdict                   28.4    29.9    27.5    25.2    23.1   24.5
    
    Stack (or queue) operations:
        list_append_pop                 93.4   112.7    75.4    74.2    50.8   50.6
        deque_append_pop                43.5    57.0    49.4    49.2    42.5   44.2
        deque_append_popleft            43.7    57.3    49.7    49.7    42.8   46.4
    
    Timing loop:
        loop_overhead                    0.5     0.6     0.4     0.3     0.3    0.3
    
    99.

  • Các tập lệnh kích hoạt

    >>> from zoneinfo import ZoneInfo
    >>> from datetime import datetime, timedelta
    
    >>> # Daylight saving time
    >>> dt = datetime(2020, 10, 31, 12, tzinfo=ZoneInfo("America/Los_Angeles"))
    >>> print(dt)
    2020-10-31 12:00:00-07:00
    >>> dt.tzname()
    'PDT'
    
    >>> # Standard time
    >>> dt += timedelta(days=7)
    >>> print(dt)
    2020-11-07 12:00:00-08:00
    >>> print(dt.tzname())
    PST
    
    34 không còn trường hợp đặc biệt khi
    >>> from zoneinfo import ZoneInfo
    >>> from datetime import datetime, timedelta
    
    >>> # Daylight saving time
    >>> dt = datetime(2020, 10, 31, 12, tzinfo=ZoneInfo("America/Los_Angeles"))
    >>> print(dt)
    2020-10-31 12:00:00-07:00
    >>> dt.tzname()
    'PDT'
    
    >>> # Standard time
    >>> dt += timedelta(days=7)
    >>> print(dt)
    2020-11-07 12:00:00-08:00
    >>> print(dt.tzname())
    PST
    
    35 được đặt thành
    int
    foo_traverse(foo_struct *self, visitproc visit, void *arg) {
    // Rest of the traverse function
    #if PY_VERSION_HEX >= 0x03090000
        // This was not needed before Python 3.9 (Python issue 35810 and 40217)
        Py_VISIT(Py_TYPE(self));
    #endif
    }
    
    02.

  • Phương pháp

    int
    foo_traverse(foo_struct *self, visitproc visit, void *arg) {
    // Rest of the traverse function
    #if PY_VERSION_HEX >= 0x03090000
        // This was not needed before Python 3.9 (Python issue 35810 and 40217)
        Py_VISIT(Py_TYPE(self));
    #endif
    }
    
    03 không còn bỏ qua lỗi
    int
    foo_traverse(foo_struct *self, visitproc visit, void *arg) {
    // Rest of the traverse function
    #if PY_VERSION_HEX >= 0x03090000
        // This was not needed before Python 3.9 (Python issue 35810 and 40217)
        Py_VISIT(Py_TYPE(self));
    #endif
    }
    
    04. (Được đóng góp bởi Victor Stinner trong BPO-39239.)

  • Tham số nén của

    Python version                       3.4     3.5     3.6     3.7     3.8    3.9
    --------------                       ---     ---     ---     ---     ---    ---
    
    Variable and attribute read access:
        read_local                       7.1     7.1     5.4     5.1     3.9    3.9
        read_nonlocal                    7.1     8.1     5.8     5.4     4.4    4.5
        read_global                     15.5    19.0    14.3    13.6     7.6    7.8
        read_builtin                    21.1    21.6    18.5    19.0     7.5    7.8
        read_classvar_from_class        25.6    26.5    20.7    19.5    18.4   17.9
        read_classvar_from_instance     22.8    23.5    18.8    17.1    16.4   16.9
        read_instancevar                32.4    33.1    28.0    26.3    25.4   25.3
        read_instancevar_slots          27.8    31.3    20.8    20.8    20.2   20.5
        read_namedtuple                 73.8    57.5    45.0    46.8    18.4   18.7
        read_boundmethod                37.6    37.9    29.6    26.9    27.7   41.1
    
    Variable and attribute write access:
        write_local                      8.7     9.3     5.5     5.3     4.3    4.3
        write_nonlocal                  10.5    11.1     5.6     5.5     4.7    4.8
        write_global                    19.7    21.2    18.0    18.0    15.8   16.7
        write_classvar                  92.9    96.0   104.6   102.1    39.2   39.8
        write_instancevar               44.6    45.8    40.0    38.9    35.5   37.4
        write_instancevar_slots         35.6    36.1    27.3    26.6    25.7   25.8
    
    Data structure read access:
        read_list                       24.2    24.5    20.8    20.8    19.0   19.5
        read_deque                      24.7    25.5    20.2    20.6    19.8   20.2
        read_dict                       24.3    25.7    22.3    23.0    21.0   22.4
        read_strdict                    22.6    24.3    19.5    21.2    18.9   21.5
    
    Data structure write access:
        write_list                      27.1    28.5    22.5    21.6    20.0   20.0
        write_deque                     28.7    30.1    22.7    21.8    23.5   21.7
        write_dict                      31.4    33.3    29.3    29.2    24.7   25.4
        write_strdict                   28.4    29.9    27.5    25.2    23.1   24.5
    
    Stack (or queue) operations:
        list_append_pop                 93.4   112.7    75.4    74.2    50.8   50.6
        deque_append_pop                43.5    57.0    49.4    49.2    42.5   44.2
        deque_append_popleft            43.7    57.3    49.7    49.7    42.8   46.4
    
    Timing loop:
        loop_overhead                    0.5     0.6     0.4     0.3     0.3    0.3
    
    69 chỉ có từ khóa, vì tham số bộ đệm đã bị xóa. (Được đóng góp bởi Victor Stinner trong BPO-39357.)

  • Đơn giản hóa AST cho đăng ký. Các chỉ số đơn giản sẽ được biểu diễn bằng giá trị của chúng, các lát cắt mở rộng sẽ được biểu diễn dưới dạng bộ dữ liệu.

    >>> from zoneinfo import ZoneInfo
    >>> from datetime import datetime, timedelta
    
    >>> # Daylight saving time
    >>> dt = datetime(2020, 10, 31, 12, tzinfo=ZoneInfo("America/Los_Angeles"))
    >>> print(dt)
    2020-10-31 12:00:00-07:00
    >>> dt.tzname()
    'PDT'
    
    >>> # Standard time
    >>> dt += timedelta(days=7)
    >>> print(dt)
    2020-11-07 12:00:00-08:00
    >>> print(dt.tzname())
    PST
    
    94 sẽ tự trả về một
    >>> from zoneinfo import ZoneInfo
    >>> from datetime import datetime, timedelta
    
    >>> # Daylight saving time
    >>> dt = datetime(2020, 10, 31, 12, tzinfo=ZoneInfo("America/Los_Angeles"))
    >>> print(dt)
    2020-10-31 12:00:00-07:00
    >>> dt.tzname()
    'PDT'
    
    >>> # Standard time
    >>> dt += timedelta(days=7)
    >>> print(dt)
    2020-11-07 12:00:00-08:00
    >>> print(dt.tzname())
    PST
    
    93,
    >>> from zoneinfo import ZoneInfo
    >>> from datetime import datetime, timedelta
    
    >>> # Daylight saving time
    >>> dt = datetime(2020, 10, 31, 12, tzinfo=ZoneInfo("America/Los_Angeles"))
    >>> print(dt)
    2020-10-31 12:00:00-07:00
    >>> dt.tzname()
    'PDT'
    
    >>> # Standard time
    >>> dt += timedelta(days=7)
    >>> print(dt)
    2020-11-07 12:00:00-08:00
    >>> print(dt.tzname())
    PST
    
    96 sẽ trả về
    >>> from zoneinfo import ZoneInfo
    >>> from datetime import datetime, timedelta
    
    >>> # Daylight saving time
    >>> dt = datetime(2020, 10, 31, 12, tzinfo=ZoneInfo("America/Los_Angeles"))
    >>> print(dt)
    2020-10-31 12:00:00-07:00
    >>> dt.tzname()
    'PDT'
    
    >>> # Standard time
    >>> dt += timedelta(days=7)
    >>> print(dt)
    2020-11-07 12:00:00-08:00
    >>> print(dt.tzname())
    PST
    
    95. (Được đóng góp bởi Serhiy Storchaka trong BPO-34822.)

  • Mô -đun

    int
    foo_traverse(foo_struct *self, visitproc visit, void *arg) {
    // Rest of the traverse function
    #if PY_VERSION_HEX >= 0x03090000
        // This was not needed before Python 3.9 (Python issue 35810 and 40217)
        Py_VISIT(Py_TYPE(self));
    #endif
    }
    
    10 hiện bỏ qua biến môi trường
    int
    foo_traverse(foo_struct *self, visitproc visit, void *arg) {
    // Rest of the traverse function
    #if PY_VERSION_HEX >= 0x03090000
        // This was not needed before Python 3.9 (Python issue 35810 and 40217)
        Py_VISIT(Py_TYPE(self));
    #endif
    }
    
    11 khi các tùy chọn dòng lệnh
    int
    foo_traverse(foo_struct *self, visitproc visit, void *arg) {
    // Rest of the traverse function
    #if PY_VERSION_HEX >= 0x03090000
        // This was not needed before Python 3.9 (Python issue 35810 and 40217)
        Py_VISIT(Py_TYPE(self));
    #endif
    }
    
    12 hoặc
    int
    foo_traverse(foo_struct *self, visitproc visit, void *arg) {
    // Rest of the traverse function
    #if PY_VERSION_HEX >= 0x03090000
        // This was not needed before Python 3.9 (Python issue 35810 and 40217)
        Py_VISIT(Py_TYPE(self));
    #endif
    }
    
    13 đang được sử dụng.
    int
    foo_traverse(foo_struct *self, visitproc visit, void *arg) {
    // Rest of the traverse function
    #if PY_VERSION_HEX >= 0x03090000
        // This was not needed before Python 3.9 (Python issue 35810 and 40217)
        Py_VISIT(Py_TYPE(self));
    #endif
    }
    
    11 environment variable when the
    int
    foo_traverse(foo_struct *self, visitproc visit, void *arg) {
    // Rest of the traverse function
    #if PY_VERSION_HEX >= 0x03090000
        // This was not needed before Python 3.9 (Python issue 35810 and 40217)
        Py_VISIT(Py_TYPE(self));
    #endif
    }
    
    12 or
    int
    foo_traverse(foo_struct *self, visitproc visit, void *arg) {
    // Rest of the traverse function
    #if PY_VERSION_HEX >= 0x03090000
        // This was not needed before Python 3.9 (Python issue 35810 and 40217)
        Py_VISIT(Py_TYPE(self));
    #endif
    }
    
    13 command line options are being used.

  • Tham số mã hóa đã được thêm vào các lớp

    int
    foo_traverse(foo_struct *self, visitproc visit, void *arg) {
    // Rest of the traverse function
    #if PY_VERSION_HEX >= 0x03090000
        // This was not needed before Python 3.9 (Python issue 35810 and 40217)
        Py_VISIT(Py_TYPE(self));
    #endif
    }
    
    14 và
    int
    foo_traverse(foo_struct *self, visitproc visit, void *arg) {
    // Rest of the traverse function
    #if PY_VERSION_HEX >= 0x03090000
        // This was not needed before Python 3.9 (Python issue 35810 and 40217)
        Py_VISIT(Py_TYPE(self));
    #endif
    }
    
    15 dưới dạng tham số chỉ từ khóa và mã hóa mặc định được thay đổi từ Latin-1 thành UTF-8 để theo RFC 2640.RFC 2640.

  • int
    foo_traverse(foo_struct *self, visitproc visit, void *arg) {
    // Rest of the traverse function
    #if PY_VERSION_HEX >= 0x03090000
        // This was not needed before Python 3.9 (Python issue 35810 and 40217)
        Py_VISIT(Py_TYPE(self));
    #endif
    }
    
    16 đã được thêm vào
    int
    foo_traverse(foo_struct *self, visitproc visit, void *arg) {
    // Rest of the traverse function
    #if PY_VERSION_HEX >= 0x03090000
        // This was not needed before Python 3.9 (Python issue 35810 and 40217)
        Py_VISIT(Py_TYPE(self));
    #endif
    }
    
    17, có nghĩa là các vòng lặp sự kiện thay thế kế thừa từ nó nên có phương pháp này được xác định. (Được đóng góp bởi Kyle Stanley trong BPO-34037.)

  • Các giá trị không đổi của các cờ trong tương lai trong mô -đun

    int
    foo_traverse(foo_struct *self, visitproc visit, void *arg) {
    // Rest of the traverse function
    #if PY_VERSION_HEX >= 0x03090000
        // This was not needed before Python 3.9 (Python issue 35810 and 40217)
        Py_VISIT(Py_TYPE(self));
    #endif
    }
    
    18 được cập nhật để ngăn chặn va chạm bằng cờ trình biên dịch. Trước đây
    int
    foo_traverse(foo_struct *self, visitproc visit, void *arg) {
    // Rest of the traverse function
    #if PY_VERSION_HEX >= 0x03090000
        // This was not needed before Python 3.9 (Python issue 35810 and 40217)
        Py_VISIT(Py_TYPE(self));
    #endif
    }
    
    19 đã đụng độ với
    int
    foo_traverse(foo_struct *self, visitproc visit, void *arg) {
    // Rest of the traverse function
    #if PY_VERSION_HEX >= 0x03090000
        // This was not needed before Python 3.9 (Python issue 35810 and 40217)
        Py_VISIT(Py_TYPE(self));
    #endif
    }
    
    20. (Được đóng góp bởi Batuhan Taskaya trong BPO-39562)

  • int
    foo_traverse(foo_struct *self, visitproc visit, void *arg) {
    // Rest of the traverse function
    #if PY_VERSION_HEX >= 0x03090000
        // This was not needed before Python 3.9 (Python issue 35810 and 40217)
        Py_VISIT(Py_TYPE(self));
    #endif
    }
    
    21 hiện sử dụng
    int
    foo_traverse(foo_struct *self, visitproc visit, void *arg) {
    // Rest of the traverse function
    #if PY_VERSION_HEX >= 0x03090000
        // This was not needed before Python 3.9 (Python issue 35810 and 40217)
        Py_VISIT(Py_TYPE(self));
    #endif
    }
    
    22 làm loại C thay vì
    int
    foo_traverse(foo_struct *self, visitproc visit, void *arg) {
    // Rest of the traverse function
    #if PY_VERSION_HEX >= 0x03090000
        // This was not needed before Python 3.9 (Python issue 35810 and 40217)
        Py_VISIT(Py_TYPE(self));
    #endif
    }
    
    23. Sự thay đổi này không ảnh hưởng đến hành vi của nó vì
    int
    foo_traverse(foo_struct *self, visitproc visit, void *arg) {
    // Rest of the traverse function
    #if PY_VERSION_HEX >= 0x03090000
        // This was not needed before Python 3.9 (Python issue 35810 and 40217)
        Py_VISIT(Py_TYPE(self));
    #endif
    }
    
    23 là bí danh của
    int
    foo_traverse(foo_struct *self, visitproc visit, void *arg) {
    // Rest of the traverse function
    #if PY_VERSION_HEX >= 0x03090000
        // This was not needed before Python 3.9 (Python issue 35810 and 40217)
        Py_VISIT(Py_TYPE(self));
    #endif
    }
    
    22 kể từ Python 3.3. (Được đóng góp bởi Inada Naoki trong BPO-34538.)

  • API

    int
    foo_traverse(foo_struct *self, visitproc visit, void *arg) {
    // Rest of the traverse function
    #if PY_VERSION_HEX >= 0x03090000
        // This was not needed before Python 3.9 (Python issue 35810 and 40217)
        Py_VISIT(Py_TYPE(self));
    #endif
    }
    
    26 hiện trả về logger gốc khi chuyển tên
    int
    foo_traverse(foo_struct *self, visitproc visit, void *arg) {
    // Rest of the traverse function
    #if PY_VERSION_HEX >= 0x03090000
        // This was not needed before Python 3.9 (Python issue 35810 and 40217)
        Py_VISIT(Py_TYPE(self));
    #endif
    }
    
    27, trong khi trước đó nó đã trả về một logger không root có tên
    int
    foo_traverse(foo_struct *self, visitproc visit, void *arg) {
    // Rest of the traverse function
    #if PY_VERSION_HEX >= 0x03090000
        // This was not needed before Python 3.9 (Python issue 35810 and 40217)
        Py_VISIT(Py_TYPE(self));
    #endif
    }
    
    27. Điều này có thể ảnh hưởng đến các trường hợp mã người dùng rõ ràng muốn ghi nhật ký không có tên có tên
    int
    foo_traverse(foo_struct *self, visitproc visit, void *arg) {
    // Rest of the traverse function
    #if PY_VERSION_HEX >= 0x03090000
        // This was not needed before Python 3.9 (Python issue 35810 and 40217)
        Py_VISIT(Py_TYPE(self));
    #endif
    }
    
    27 hoặc khởi động một logger bằng cách sử dụng
    int
    foo_traverse(foo_struct *self, visitproc visit, void *arg) {
    // Rest of the traverse function
    #if PY_VERSION_HEX >= 0x03090000
        // This was not needed before Python 3.9 (Python issue 35810 and 40217)
        Py_VISIT(Py_TYPE(self));
    #endif
    }
    
    30 trong một số mô-đun cấp cao nhất có tên là
    int
    foo_traverse(foo_struct *self, visitproc visit, void *arg) {
    // Rest of the traverse function
    #if PY_VERSION_HEX >= 0x03090000
        // This was not needed before Python 3.9 (Python issue 35810 and 40217)
        Py_VISIT(Py_TYPE(self));
    #endif
    }
    
    31. (Được đóng góp bởi Vinay Sajip trong BPO-37742.)

  • Xử lý phân chia

    int
    foo_traverse(foo_struct *self, visitproc visit, void *arg) {
    // Rest of the traverse function
    #if PY_VERSION_HEX >= 0x03090000
        // This was not needed before Python 3.9 (Python issue 35810 and 40217)
        Py_VISIT(Py_TYPE(self));
    #endif
    }
    
    32 hiện trả về
    >>> from zoneinfo import ZoneInfo
    >>> from datetime import datetime, timedelta
    
    >>> # Daylight saving time
    >>> dt = datetime(2020, 10, 31, 12, tzinfo=ZoneInfo("America/Los_Angeles"))
    >>> print(dt)
    2020-10-31 12:00:00-07:00
    >>> dt.tzname()
    'PDT'
    
    >>> # Standard time
    >>> dt += timedelta(days=7)
    >>> print(dt)
    2020-11-07 12:00:00-08:00
    >>> print(dt.tzname())
    PST
    
    69 thay vì tăng os.pidfd_open()8 khi được thông qua một thứ khác ngoài một ví dụ là
    >>> from zoneinfo import ZoneInfo
    >>> from datetime import datetime, timedelta
    
    >>> # Daylight saving time
    >>> dt = datetime(2020, 10, 31, 12, tzinfo=ZoneInfo("America/Los_Angeles"))
    >>> print(dt)
    2020-10-31 12:00:00-07:00
    >>> dt.tzname()
    'PDT'
    
    >>> # Standard time
    >>> dt += timedelta(days=7)
    >>> print(dt)
    2020-11-07 12:00:00-08:00
    >>> print(dt.tzname())
    PST
    
    75 hoặc
    int
    foo_traverse(foo_struct *self, visitproc visit, void *arg) {
    // Rest of the traverse function
    #if PY_VERSION_HEX >= 0x03090000
        // This was not needed before Python 3.9 (Python issue 35810 and 40217)
        Py_VISIT(Py_TYPE(self));
    #endif
    }
    
    32. Điều này cho phép tạo các lớp tương thích mà don lồng thừa kế từ các loại được đề cập. (Được đóng góp bởi Roger Aiudi trong BPO-34775).

  • Bắt đầu với Python 3.9.5 Mô -đun

    def greet_all(names: list[str]) -> None:
        for name in names:
            print("Hello", name)
    
    78 không còn chấp nhận bất kỳ số 0 hàng đầu nào trong chuỗi địa chỉ IPv4. Các số không hàng đầu là mơ hồ và được hiểu là ký hiệu bát phân của một số thư viện. Ví dụ, hàm di sản
    int
    foo_traverse(foo_struct *self, visitproc visit, void *arg) {
    // Rest of the traverse function
    #if PY_VERSION_HEX >= 0x03090000
        // This was not needed before Python 3.9 (Python issue 35810 and 40217)
        Py_VISIT(Py_TYPE(self));
    #endif
    }
    
    38 coi các số 0 hàng đầu là sự không phân bổ bát phân. Việc thực hiện GLIBC của
    int
    foo_traverse(foo_struct *self, visitproc visit, void *arg) {
    // Rest of the traverse function
    #if PY_VERSION_HEX >= 0x03090000
        // This was not needed before Python 3.9 (Python issue 35810 and 40217)
        Py_VISIT(Py_TYPE(self));
    #endif
    }
    
    39 hiện đại không chấp nhận bất kỳ số không hàng đầu nào. (Được đóng góp bởi Christian Heimes trong BPO-36384).

  • int
    foo_traverse(foo_struct *self, visitproc visit, void *arg) {
    // Rest of the traverse function
    #if PY_VERSION_HEX >= 0x03090000
        // This was not needed before Python 3.9 (Python issue 35810 and 40217)
        Py_VISIT(Py_TYPE(self));
    #endif
    }
    
    40 Bây giờ bình thường hóa tên mã hóa giống như
    int
    foo_traverse(foo_struct *self, visitproc visit, void *arg) {
    // Rest of the traverse function
    #if PY_VERSION_HEX >= 0x03090000
        // This was not needed before Python 3.9 (Python issue 35810 and 40217)
        Py_VISIT(Py_TYPE(self));
    #endif
    }
    
    41, ngoại trừ
    int
    foo_traverse(foo_struct *self, visitproc visit, void *arg) {
    // Rest of the traverse function
    #if PY_VERSION_HEX >= 0x03090000
        // This was not needed before Python 3.9 (Python issue 35810 and 40217)
        Py_VISIT(Py_TYPE(self));
    #endif
    }
    
    40 cũng chuyển đổi tên thành chữ thường. Ví dụ: tên mã hóa
    int
    foo_traverse(foo_struct *self, visitproc visit, void *arg) {
    // Rest of the traverse function
    #if PY_VERSION_HEX >= 0x03090000
        // This was not needed before Python 3.9 (Python issue 35810 and 40217)
        Py_VISIT(Py_TYPE(self));
    #endif
    }
    
    43 hiện được chuẩn hóa thành
    int
    foo_traverse(foo_struct *self, visitproc visit, void *arg) {
    // Rest of the traverse function
    #if PY_VERSION_HEX >= 0x03090000
        // This was not needed before Python 3.9 (Python issue 35810 and 40217)
        Py_VISIT(Py_TYPE(self));
    #endif
    }
    
    44. (Được đóng góp bởi Jordon Xu trong BPO-37751.)

Những thay đổi trong C API¶

  • Các phiên bản của các loại được phân bổ nặng (chẳng hạn như các loại được tạo bằng

    int
    foo_traverse(foo_struct *self, visitproc visit, void *arg) {
    // Rest of the traverse function
    #if PY_VERSION_HEX >= 0x03090000
        // This was not needed before Python 3.9 (Python issue 35810 and 40217)
        Py_VISIT(Py_TYPE(self));
    #endif
    }
    
    45 và API tương tự) giữ một tham chiếu đến đối tượng loại của chúng kể từ Python 3.8. Như được chỉ ra trong các thay đổi của người Viking trong C API của Python 3.8, đối với phần lớn các trường hợp, không có tác dụng phụ mà đối với các loại có chức năng
    int
    foo_traverse(foo_struct *self, visitproc visit, void *arg) {
    // Rest of the traverse function
    #if PY_VERSION_HEX >= 0x03090000
        // This was not needed before Python 3.9 (Python issue 35810 and 40217)
        Py_VISIT(Py_TYPE(self));
    #endif
    }
    
    46 tùy chỉnh, hãy đảm bảo rằng tất cả các chức năng
    int
    foo_traverse(foo_struct *self, visitproc visit, void *arg) {
    // Rest of the traverse function
    #if PY_VERSION_HEX >= 0x03090000
        // This was not needed before Python 3.9 (Python issue 35810 and 40217)
        Py_VISIT(Py_TYPE(self));
    #endif
    }
    
    46 tùy chỉnh của các loại được phân bổ loại đối tượng.heap-allocated types (such as those created with
    int
    foo_traverse(foo_struct *self, visitproc visit, void *arg) {
    // Rest of the traverse function
    #if PY_VERSION_HEX >= 0x03090000
        // This was not needed before Python 3.9 (Python issue 35810 and 40217)
        Py_VISIT(Py_TYPE(self));
    #endif
    }
    
    45 and similar APIs) hold a reference to their type object since Python 3.8. As indicated in the “Changes in the C API” of Python 3.8, for the vast majority of cases, there should be no side effect but for types that have a custom
    int
    foo_traverse(foo_struct *self, visitproc visit, void *arg) {
    // Rest of the traverse function
    #if PY_VERSION_HEX >= 0x03090000
        // This was not needed before Python 3.9 (Python issue 35810 and 40217)
        Py_VISIT(Py_TYPE(self));
    #endif
    }
    
    46 function, ensure that all custom
    int
    foo_traverse(foo_struct *self, visitproc visit, void *arg) {
    // Rest of the traverse function
    #if PY_VERSION_HEX >= 0x03090000
        // This was not needed before Python 3.9 (Python issue 35810 and 40217)
        Py_VISIT(Py_TYPE(self));
    #endif
    }
    
    46 functions of heap-allocated types visit the object’s type.

    Example:

    int
    foo_traverse(foo_struct *self, visitproc visit, void *arg) {
    // Rest of the traverse function
    #if PY_VERSION_HEX >= 0x03090000
        // This was not needed before Python 3.9 (Python issue 35810 and 40217)
        Py_VISIT(Py_TYPE(self));
    #endif
    }
    

    Nếu chức năng Traverse của bạn ủy quyền cho

    int
    foo_traverse(foo_struct *self, visitproc visit, void *arg) {
    // Rest of the traverse function
    #if PY_VERSION_HEX >= 0x03090000
        // This was not needed before Python 3.9 (Python issue 35810 and 40217)
        Py_VISIT(Py_TYPE(self));
    #endif
    }
    
    46 của lớp cơ sở (hoặc loại khác), hãy đảm bảo rằng
    int
    foo_traverse(foo_struct *self, visitproc visit, void *arg) {
    // Rest of the traverse function
    #if PY_VERSION_HEX >= 0x03090000
        // This was not needed before Python 3.9 (Python issue 35810 and 40217)
        Py_VISIT(Py_TYPE(self));
    #endif
    }
    
    49 chỉ được truy cập một lần. Lưu ý rằng chỉ có loại heap dự kiến ​​sẽ truy cập loại trong
    int
    foo_traverse(foo_struct *self, visitproc visit, void *arg) {
    // Rest of the traverse function
    #if PY_VERSION_HEX >= 0x03090000
        // This was not needed before Python 3.9 (Python issue 35810 and 40217)
        Py_VISIT(Py_TYPE(self));
    #endif
    }
    
    46.heap type are expected to visit the type in
    int
    foo_traverse(foo_struct *self, visitproc visit, void *arg) {
    // Rest of the traverse function
    #if PY_VERSION_HEX >= 0x03090000
        // This was not needed before Python 3.9 (Python issue 35810 and 40217)
        Py_VISIT(Py_TYPE(self));
    #endif
    }
    
    46.

    Ví dụ: nếu hàm

    int
    foo_traverse(foo_struct *self, visitproc visit, void *arg) {
    // Rest of the traverse function
    #if PY_VERSION_HEX >= 0x03090000
        // This was not needed before Python 3.9 (Python issue 35810 and 40217)
        Py_VISIT(Py_TYPE(self));
    #endif
    }
    
    46 của bạn bao gồm:

    base->tp_traverse(self, visit, arg)
    

    Sau đó thêm:

    #if PY_VERSION_HEX >= 0x03090000
        // This was not needed before Python 3.9 (bpo-35810 and bpo-40217)
        if (base->tp_flags & Py_TPFLAGS_HEAPTYPE) {
            // a heap type's tp_traverse already visited Py_TYPE(self)
        } else {
            Py_VISIT(Py_TYPE(self));
        }
    #else
    

    (Xem BPO-35810 và BPO-40217 để biết thêm thông tin.)

  • Các chức năng

    int
    foo_traverse(foo_struct *self, visitproc visit, void *arg) {
    // Rest of the traverse function
    #if PY_VERSION_HEX >= 0x03090000
        // This was not needed before Python 3.9 (Python issue 35810 and 40217)
        Py_VISIT(Py_TYPE(self));
    #endif
    }
    
    52,
    int
    foo_traverse(foo_struct *self, visitproc visit, void *arg) {
    // Rest of the traverse function
    #if PY_VERSION_HEX >= 0x03090000
        // This was not needed before Python 3.9 (Python issue 35810 and 40217)
        Py_VISIT(Py_TYPE(self));
    #endif
    }
    
    53,
    int
    foo_traverse(foo_struct *self, visitproc visit, void *arg) {
    // Rest of the traverse function
    #if PY_VERSION_HEX >= 0x03090000
        // This was not needed before Python 3.9 (Python issue 35810 and 40217)
        Py_VISIT(Py_TYPE(self));
    #endif
    }
    
    54 và
    int
    foo_traverse(foo_struct *self, visitproc visit, void *arg) {
    // Rest of the traverse function
    #if PY_VERSION_HEX >= 0x03090000
        // This was not needed before Python 3.9 (Python issue 35810 and 40217)
        Py_VISIT(Py_TYPE(self));
    #endif
    }
    
    55 không được chấp nhận. Thay vào đó, sử dụng
    int
    foo_traverse(foo_struct *self, visitproc visit, void *arg) {
    // Rest of the traverse function
    #if PY_VERSION_HEX >= 0x03090000
        // This was not needed before Python 3.9 (Python issue 35810 and 40217)
        Py_VISIT(Py_TYPE(self));
    #endif
    }
    
    56 và các biến thể của nó. (Xem thêm chi tiết trong BPO-29548.)

CPYTHON BYTECODE thay đổi Or

  • Opcode

    int
    foo_traverse(foo_struct *self, visitproc visit, void *arg) {
    // Rest of the traverse function
    #if PY_VERSION_HEX >= 0x03090000
        // This was not needed before Python 3.9 (Python issue 35810 and 40217)
        Py_VISIT(Py_TYPE(self));
    #endif
    }
    
    57 đã được thêm vào để xử lý câu lệnh
    int
    foo_traverse(foo_struct *self, visitproc visit, void *arg) {
    // Rest of the traverse function
    #if PY_VERSION_HEX >= 0x03090000
        // This was not needed before Python 3.9 (Python issue 35810 and 40217)
        Py_VISIT(Py_TYPE(self));
    #endif
    }
    
    58. Trước đây, câu lệnh ASPER sẽ không hoạt động chính xác nếu ngoại lệ
    int
    foo_traverse(foo_struct *self, visitproc visit, void *arg) {
    // Rest of the traverse function
    #if PY_VERSION_HEX >= 0x03090000
        // This was not needed before Python 3.9 (Python issue 35810 and 40217)
        Py_VISIT(Py_TYPE(self));
    #endif
    }
    
    59 bị che mờ. (Được đóng góp bởi Zackery Spytz trong BPO-34880.)

  • Opcode

    int
    foo_traverse(foo_struct *self, visitproc visit, void *arg) {
    // Rest of the traverse function
    #if PY_VERSION_HEX >= 0x03090000
        // This was not needed before Python 3.9 (Python issue 35810 and 40217)
        Py_VISIT(Py_TYPE(self));
    #endif
    }
    
    60 được chia thành bốn hướng dẫn riêng biệt:

    • int
      foo_traverse(foo_struct *self, visitproc visit, void *arg) {
      // Rest of the traverse function
      #if PY_VERSION_HEX >= 0x03090000
          // This was not needed before Python 3.9 (Python issue 35810 and 40217)
          Py_VISIT(Py_TYPE(self));
      #endif
      }
      
      60 để so sánh phong phú

    • int
      foo_traverse(foo_struct *self, visitproc visit, void *arg) {
      // Rest of the traverse function
      #if PY_VERSION_HEX >= 0x03090000
          // This was not needed before Python 3.9 (Python issue 35810 and 40217)
          Py_VISIT(Py_TYPE(self));
      #endif
      }
      
      62 cho is is is và ’không phải là các bài kiểm tra

    • int
      foo_traverse(foo_struct *self, visitproc visit, void *arg) {
      // Rest of the traverse function
      #if PY_VERSION_HEX >= 0x03090000
          // This was not needed before Python 3.9 (Python issue 35810 and 40217)
          Py_VISIT(Py_TYPE(self));
      #endif
      }
      
      63 cho ‘trong các bài kiểm tra và không trong các bài kiểm tra

    • int
      foo_traverse(foo_struct *self, visitproc visit, void *arg) {
      // Rest of the traverse function
      #if PY_VERSION_HEX >= 0x03090000
          // This was not needed before Python 3.9 (Python issue 35810 and 40217)
          Py_VISIT(Py_TYPE(self));
      #endif
      }
      
      64 để kiểm tra các ngoại lệ trong các câu lệnh Try-Except.

    (Được đóng góp bởi Mark Shannon trong BPO-39156.)

Xây dựng thay đổi Jor

  • Đã thêm tùy chọn

    int
    foo_traverse(foo_struct *self, visitproc visit, void *arg) {
    // Rest of the traverse function
    #if PY_VERSION_HEX >= 0x03090000
        // This was not needed before Python 3.9 (Python issue 35810 and 40217)
        Py_VISIT(Py_TYPE(self));
    #endif
    }
    
    65 vào tập lệnh
    int
    foo_traverse(foo_struct *self, visitproc visit, void *arg) {
    // Rest of the traverse function
    #if PY_VERSION_HEX >= 0x03090000
        // This was not needed before Python 3.9 (Python issue 35810 and 40217)
        Py_VISIT(Py_TYPE(self));
    #endif
    }
    
    66: Tên của thư mục thư viện dành riêng cho nền tảng, được lưu trữ trong thuộc tính
    >>> from zoneinfo import ZoneInfo
    >>> from datetime import datetime, timedelta
    
    >>> # Daylight saving time
    >>> dt = datetime(2020, 10, 31, 12, tzinfo=ZoneInfo("America/Los_Angeles"))
    >>> print(dt)
    2020-10-31 12:00:00-07:00
    >>> dt.tzname()
    'PDT'
    
    >>> # Standard time
    >>> dt += timedelta(days=7)
    >>> print(dt)
    2020-11-07 12:00:00-08:00
    >>> print(dt.tzname())
    PST
    
    25 mới. Xem thuộc tính
    >>> from zoneinfo import ZoneInfo
    >>> from datetime import datetime, timedelta
    
    >>> # Daylight saving time
    >>> dt = datetime(2020, 10, 31, 12, tzinfo=ZoneInfo("America/Los_Angeles"))
    >>> print(dt)
    2020-10-31 12:00:00-07:00
    >>> dt.tzname()
    'PDT'
    
    >>> # Standard time
    >>> dt += timedelta(days=7)
    >>> print(dt)
    2020-11-07 12:00:00-08:00
    >>> print(dt.tzname())
    PST
    
    25 để biết thêm thông tin. .

  • Macro xây dựng đặc biệt

    Python version                       3.4     3.5     3.6     3.7     3.8    3.9
    --------------                       ---     ---     ---     ---     ---    ---
    
    Variable and attribute read access:
        read_local                       7.1     7.1     5.4     5.1     3.9    3.9
        read_nonlocal                    7.1     8.1     5.8     5.4     4.4    4.5
        read_global                     15.5    19.0    14.3    13.6     7.6    7.8
        read_builtin                    21.1    21.6    18.5    19.0     7.5    7.8
        read_classvar_from_class        25.6    26.5    20.7    19.5    18.4   17.9
        read_classvar_from_instance     22.8    23.5    18.8    17.1    16.4   16.9
        read_instancevar                32.4    33.1    28.0    26.3    25.4   25.3
        read_instancevar_slots          27.8    31.3    20.8    20.8    20.2   20.5
        read_namedtuple                 73.8    57.5    45.0    46.8    18.4   18.7
        read_boundmethod                37.6    37.9    29.6    26.9    27.7   41.1
    
    Variable and attribute write access:
        write_local                      8.7     9.3     5.5     5.3     4.3    4.3
        write_nonlocal                  10.5    11.1     5.6     5.5     4.7    4.8
        write_global                    19.7    21.2    18.0    18.0    15.8   16.7
        write_classvar                  92.9    96.0   104.6   102.1    39.2   39.8
        write_instancevar               44.6    45.8    40.0    38.9    35.5   37.4
        write_instancevar_slots         35.6    36.1    27.3    26.6    25.7   25.8
    
    Data structure read access:
        read_list                       24.2    24.5    20.8    20.8    19.0   19.5
        read_deque                      24.7    25.5    20.2    20.6    19.8   20.2
        read_dict                       24.3    25.7    22.3    23.0    21.0   22.4
        read_strdict                    22.6    24.3    19.5    21.2    18.9   21.5
    
    Data structure write access:
        write_list                      27.1    28.5    22.5    21.6    20.0   20.0
        write_deque                     28.7    30.1    22.7    21.8    23.5   21.7
        write_dict                      31.4    33.3    29.3    29.2    24.7   25.4
        write_strdict                   28.4    29.9    27.5    25.2    23.1   24.5
    
    Stack (or queue) operations:
        list_append_pop                 93.4   112.7    75.4    74.2    50.8   50.6
        deque_append_pop                43.5    57.0    49.4    49.2    42.5   44.2
        deque_append_popleft            43.7    57.3    49.7    49.7    42.8   46.4
    
    Timing loop:
        loop_overhead                    0.5     0.6     0.4     0.3     0.3    0.3
    
    82 đã bị loại bỏ. (Được đóng góp bởi Victor Stinner trong BPO-39489.)

  • Trên các nền tảng không phải Windows, các chức năng

    int
    foo_traverse(foo_struct *self, visitproc visit, void *arg) {
    // Rest of the traverse function
    #if PY_VERSION_HEX >= 0x03090000
        // This was not needed before Python 3.9 (Python issue 35810 and 40217)
        Py_VISIT(Py_TYPE(self));
    #endif
    }
    
    70 và
    int
    foo_traverse(foo_struct *self, visitproc visit, void *arg) {
    // Rest of the traverse function
    #if PY_VERSION_HEX >= 0x03090000
        // This was not needed before Python 3.9 (Python issue 35810 and 40217)
        Py_VISIT(Py_TYPE(self));
    #endif
    }
    
    71 hiện được yêu cầu để xây dựng Python. (Được đóng góp bởi Victor Stinner trong BPO-39395.)

  • Trên các nền tảng không phải Windows, việc tạo trình cài đặt

    int
    foo_traverse(foo_struct *self, visitproc visit, void *arg) {
    // Rest of the traverse function
    #if PY_VERSION_HEX >= 0x03090000
        // This was not needed before Python 3.9 (Python issue 35810 and 40217)
        Py_VISIT(Py_TYPE(self));
    #endif
    }
    
    72 hiện chính thức không được hỗ trợ. (Xem BPO-10945 để biết thêm chi tiết.)

  • Khi xây dựng Python trên các macOS từ nguồn,

    int
    foo_traverse(foo_struct *self, visitproc visit, void *arg) {
    // Rest of the traverse function
    #if PY_VERSION_HEX >= 0x03090000
        // This was not needed before Python 3.9 (Python issue 35810 and 40217)
        Py_VISIT(Py_TYPE(self));
    #endif
    }
    
    73 hiện liên kết với các khung TCL và TK không phải hệ thống nếu chúng được cài đặt trong
    int
    foo_traverse(foo_struct *self, visitproc visit, void *arg) {
    // Rest of the traverse function
    #if PY_VERSION_HEX >= 0x03090000
        // This was not needed before Python 3.9 (Python issue 35810 and 40217)
        Py_VISIT(Py_TYPE(self));
    #endif
    }
    
    74, như đã từng là trường hợp phát hành MacOS cũ hơn. Nếu SDK MacOS được cấu hình rõ ràng, bằng cách sử dụng
    int
    foo_traverse(foo_struct *self, visitproc visit, void *arg) {
    // Rest of the traverse function
    #if PY_VERSION_HEX >= 0x03090000
        // This was not needed before Python 3.9 (Python issue 35810 and 40217)
        Py_VISIT(Py_TYPE(self));
    #endif
    }
    
    75 hoặc
    int
    foo_traverse(foo_struct *self, visitproc visit, void *arg) {
    // Rest of the traverse function
    #if PY_VERSION_HEX >= 0x03090000
        // This was not needed before Python 3.9 (Python issue 35810 and 40217)
        Py_VISIT(Py_TYPE(self));
    #endif
    }
    
    76, chỉ có chính SDK được tìm kiếm. Hành vi mặc định vẫn có thể được ghi đè với
    int
    foo_traverse(foo_struct *self, visitproc visit, void *arg) {
    // Rest of the traverse function
    #if PY_VERSION_HEX >= 0x03090000
        // This was not needed before Python 3.9 (Python issue 35810 and 40217)
        Py_VISIT(Py_TYPE(self));
    #endif
    }
    
    77 và
    int
    foo_traverse(foo_struct *self, visitproc visit, void *arg) {
    // Rest of the traverse function
    #if PY_VERSION_HEX >= 0x03090000
        // This was not needed before Python 3.9 (Python issue 35810 and 40217)
        Py_VISIT(Py_TYPE(self));
    #endif
    }
    
    78. (Được đóng góp bởi NED Deily trong BPO-34956.)

  • Python hiện có thể được xây dựng cho Windows 10 Arm64. (Được đóng góp bởi Steve Dower trong BPO-33125.)

  • Một số xét nghiệm riêng lẻ hiện đã được bỏ qua khi

    int
    foo_traverse(foo_struct *self, visitproc visit, void *arg) {
    // Rest of the traverse function
    #if PY_VERSION_HEX >= 0x03090000
        // This was not needed before Python 3.9 (Python issue 35810 and 40217)
        Py_VISIT(Py_TYPE(self));
    #endif
    }
    
    79 được sử dụng. Các bài kiểm tra trong câu hỏi đã tăng đáng kể thời gian nhiệm vụ PGO và có khả năng đã giúp cải thiện việc tối ưu hóa việc thực thi cuối cùng. Điều này tăng tốc nhiệm vụ bằng một hệ số khoảng 15 lần. Chạy bộ thử nghiệm đơn vị đầy đủ là chậm. Thay đổi này có thể dẫn đến một bản dựng được tối ưu hóa ít hơn một chút vì không nhiều nhánh mã sẽ được thực thi. Nếu bạn sẵn sàng chờ đợi bản dựng chậm hơn nhiều, hành vi cũ có thể được khôi phục bằng
    int
    foo_traverse(foo_struct *self, visitproc visit, void *arg) {
    // Rest of the traverse function
    #if PY_VERSION_HEX >= 0x03090000
        // This was not needed before Python 3.9 (Python issue 35810 and 40217)
        Py_VISIT(Py_TYPE(self));
    #endif
    }
    
    80. Chúng tôi không đảm bảo về việc tập hợp tác vụ PGO tạo ra một bản dựng nhanh hơn. Người dùng chăm sóc nên chạy các điểm chuẩn có liên quan của riêng họ vì kết quả có thể phụ thuộc vào môi trường, khối lượng công việc và chuỗi công cụ trình biên dịch. (Xem BPO-36044 và BPO-37707 để biết thêm chi tiết.)

C API thay đổi Bur

Các tính năng mới¶

  • PEP 573: Đã thêm

    int
    foo_traverse(foo_struct *self, visitproc visit, void *arg) {
    // Rest of the traverse function
    #if PY_VERSION_HEX >= 0x03090000
        // This was not needed before Python 3.9 (Python issue 35810 and 40217)
        Py_VISIT(Py_TYPE(self));
    #endif
    }
    
    81 để liên kết một mô -đun với một lớp;
    int
    foo_traverse(foo_struct *self, visitproc visit, void *arg) {
    // Rest of the traverse function
    #if PY_VERSION_HEX >= 0x03090000
        // This was not needed before Python 3.9 (Python issue 35810 and 40217)
        Py_VISIT(Py_TYPE(self));
    #endif
    }
    
    82 và
    int
    foo_traverse(foo_struct *self, visitproc visit, void *arg) {
    // Rest of the traverse function
    #if PY_VERSION_HEX >= 0x03090000
        // This was not needed before Python 3.9 (Python issue 35810 and 40217)
        Py_VISIT(Py_TYPE(self));
    #endif
    }
    
    83 để truy xuất mô -đun và trạng thái của nó; và
    int
    foo_traverse(foo_struct *self, visitproc visit, void *arg) {
    // Rest of the traverse function
    #if PY_VERSION_HEX >= 0x03090000
        // This was not needed before Python 3.9 (Python issue 35810 and 40217)
        Py_VISIT(Py_TYPE(self));
    #endif
    }
    
    84 và
    int
    foo_traverse(foo_struct *self, visitproc visit, void *arg) {
    // Rest of the traverse function
    #if PY_VERSION_HEX >= 0x03090000
        // This was not needed before Python 3.9 (Python issue 35810 and 40217)
        Py_VISIT(Py_TYPE(self));
    #endif
    }
    
    85 để cho phép một phương pháp truy cập vào lớp nó được xác định. (Được đóng góp bởi Marcel Plch và Petr Viktorin trong BPO-38787.)
    : Added
    int
    foo_traverse(foo_struct *self, visitproc visit, void *arg) {
    // Rest of the traverse function
    #if PY_VERSION_HEX >= 0x03090000
        // This was not needed before Python 3.9 (Python issue 35810 and 40217)
        Py_VISIT(Py_TYPE(self));
    #endif
    }
    
    81 to associate a module with a class;
    int
    foo_traverse(foo_struct *self, visitproc visit, void *arg) {
    // Rest of the traverse function
    #if PY_VERSION_HEX >= 0x03090000
        // This was not needed before Python 3.9 (Python issue 35810 and 40217)
        Py_VISIT(Py_TYPE(self));
    #endif
    }
    
    82 and
    int
    foo_traverse(foo_struct *self, visitproc visit, void *arg) {
    // Rest of the traverse function
    #if PY_VERSION_HEX >= 0x03090000
        // This was not needed before Python 3.9 (Python issue 35810 and 40217)
        Py_VISIT(Py_TYPE(self));
    #endif
    }
    
    83 to retrieve the module and its state; and
    int
    foo_traverse(foo_struct *self, visitproc visit, void *arg) {
    // Rest of the traverse function
    #if PY_VERSION_HEX >= 0x03090000
        // This was not needed before Python 3.9 (Python issue 35810 and 40217)
        Py_VISIT(Py_TYPE(self));
    #endif
    }
    
    84 and
    int
    foo_traverse(foo_struct *self, visitproc visit, void *arg) {
    // Rest of the traverse function
    #if PY_VERSION_HEX >= 0x03090000
        // This was not needed before Python 3.9 (Python issue 35810 and 40217)
        Py_VISIT(Py_TYPE(self));
    #endif
    }
    
    85 to allow a method to access the class it was defined in. (Contributed by Marcel Plch and Petr Viktorin in bpo-38787.)

  • Đã thêm hàm

    int
    foo_traverse(foo_struct *self, visitproc visit, void *arg) {
    // Rest of the traverse function
    #if PY_VERSION_HEX >= 0x03090000
        // This was not needed before Python 3.9 (Python issue 35810 and 40217)
        Py_VISIT(Py_TYPE(self));
    #endif
    }
    
    86: Nhận mã khung. Đã thêm hàm
    int
    foo_traverse(foo_struct *self, visitproc visit, void *arg) {
    // Rest of the traverse function
    #if PY_VERSION_HEX >= 0x03090000
        // This was not needed before Python 3.9 (Python issue 35810 and 40217)
        Py_VISIT(Py_TYPE(self));
    #endif
    }
    
    87: Nhận khung bên ngoài tiếp theo. (Được đóng góp bởi Victor Stinner trong BPO-40421.)

  • Đã thêm

    int
    foo_traverse(foo_struct *self, visitproc visit, void *arg) {
    // Rest of the traverse function
    #if PY_VERSION_HEX >= 0x03090000
        // This was not needed before Python 3.9 (Python issue 35810 and 40217)
        Py_VISIT(Py_TYPE(self));
    #endif
    }
    
    88 vào API C giới hạn. (Được đóng góp bởi Victor Stinner trong BPO-40421.)

  • Đã thêm các chức năng

    int
    foo_traverse(foo_struct *self, visitproc visit, void *arg) {
    // Rest of the traverse function
    #if PY_VERSION_HEX >= 0x03090000
        // This was not needed before Python 3.9 (Python issue 35810 and 40217)
        Py_VISIT(Py_TYPE(self));
    #endif
    }
    
    89 và
    int
    foo_traverse(foo_struct *self, visitproc visit, void *arg) {
    // Rest of the traverse function
    #if PY_VERSION_HEX >= 0x03090000
        // This was not needed before Python 3.9 (Python issue 35810 and 40217)
        Py_VISIT(Py_TYPE(self));
    #endif
    }
    
    90 để có được trình thông dịch. Đã thêm hàm
    int
    foo_traverse(foo_struct *self, visitproc visit, void *arg) {
    // Rest of the traverse function
    #if PY_VERSION_HEX >= 0x03090000
        // This was not needed before Python 3.9 (Python issue 35810 and 40217)
        Py_VISIT(Py_TYPE(self));
    #endif
    }
    
    91 để có được khung hiện tại của trạng thái luồng python. Đã thêm hàm
    int
    foo_traverse(foo_struct *self, visitproc visit, void *arg) {
    // Rest of the traverse function
    #if PY_VERSION_HEX >= 0x03090000
        // This was not needed before Python 3.9 (Python issue 35810 and 40217)
        Py_VISIT(Py_TYPE(self));
    #endif
    }
    
    92: Nhận định danh duy nhất của trạng thái luồng python. (Được đóng góp bởi Victor Stinner trong BPO-39947.)

  • Đã thêm hàm

    int
    foo_traverse(foo_struct *self, visitproc visit, void *arg) {
    // Rest of the traverse function
    #if PY_VERSION_HEX >= 0x03090000
        // This was not needed before Python 3.9 (Python issue 35810 and 40217)
        Py_VISIT(Py_TYPE(self));
    #endif
    }
    
    93 công khai mới vào API C, gọi là đối tượng Python có thể gọi được mà không có bất kỳ đối số nào. Đó là cách hiệu quả nhất để gọi một đối tượng Python có thể gọi mà không có bất kỳ đối số nào. (Được đóng góp bởi Victor Stinner trong BPO-37194.)

  • Các thay đổi trong API C giới hạn (nếu

    int
    foo_traverse(foo_struct *self, visitproc visit, void *arg) {
    // Rest of the traverse function
    #if PY_VERSION_HEX >= 0x03090000
        // This was not needed before Python 3.9 (Python issue 35810 and 40217)
        Py_VISIT(Py_TYPE(self));
    #endif
    }
    
    94 macro được xác định):

    • Cung cấp

      int
      foo_traverse(foo_struct *self, visitproc visit, void *arg) {
      // Rest of the traverse function
      #if PY_VERSION_HEX >= 0x03090000
          // This was not needed before Python 3.9 (Python issue 35810 and 40217)
          Py_VISIT(Py_TYPE(self));
      #endif
      }
      
      95 và
      int
      foo_traverse(foo_struct *self, visitproc visit, void *arg) {
      // Rest of the traverse function
      #if PY_VERSION_HEX >= 0x03090000
          // This was not needed before Python 3.9 (Python issue 35810 and 40217)
          Py_VISIT(Py_TYPE(self));
      #endif
      }
      
      96 làm chức năng thường xuyên cho API giới hạn. Trước đây, được định nghĩa là macro, nhưng các macro này đã biên dịch với API C hạn chế không thể truy cập trường
      int
      foo_traverse(foo_struct *self, visitproc visit, void *arg) {
      // Rest of the traverse function
      #if PY_VERSION_HEX >= 0x03090000
          // This was not needed before Python 3.9 (Python issue 35810 and 40217)
          Py_VISIT(Py_TYPE(self));
      #endif
      }
      
      97 (cấu trúc mờ đục trong API C hạn chế).

    • int
      foo_traverse(foo_struct *self, visitproc visit, void *arg) {
      // Rest of the traverse function
      #if PY_VERSION_HEX >= 0x03090000
          // This was not needed before Python 3.9 (Python issue 35810 and 40217)
          Py_VISIT(Py_TYPE(self));
      #endif
      }
      
      98 và
      int
      foo_traverse(foo_struct *self, visitproc visit, void *arg) {
      // Rest of the traverse function
      #if PY_VERSION_HEX >= 0x03090000
          // This was not needed before Python 3.9 (Python issue 35810 and 40217)
          Py_VISIT(Py_TYPE(self));
      #endif
      }
      
      99 trở thành chức năng thường xuyên của Opaque để ẩn các chi tiết thực hiện.

    (Được đóng góp bởi Victor Stinner trong BPO-38644 và BPO-39542.)

  • Hàm

    base->tp_traverse(self, visit, arg)
    
    00 được thêm vào để giúp thêm loại vào mô -đun. (Được đóng góp bởi Dong-hee NA trong BPO-40024.)

  • Đã thêm các chức năng

    base->tp_traverse(self, visit, arg)
    
    01 và
    base->tp_traverse(self, visit, arg)
    
    02 vào API công khai để cho phép truy vấn nếu các đối tượng Python hiện đang được theo dõi hoặc đã được hoàn thành bởi Trình thu thập rác tương ứng. (Được đóng góp bởi Pablo Galindo Salgado trong BPO-40241.)

  • Đã thêm

    base->tp_traverse(self, visit, arg)
    
    03 để có được biểu diễn chuỗi thân thiện với người dùng của một đối tượng giống như hàm. (Bản vá của Jeroen Demeyer trong BPO-37645.)

  • Đã thêm

    base->tp_traverse(self, visit, arg)
    
    04 để gọi một đối tượng với một đối số vị trí (bản vá của Jeroen Demeyer trong BPO-37483.)

Chuyển sang Python 3.9¶

  • base->tp_traverse(self, visit, arg)
    
    05 (PEP 523) hiện yêu cầu tham số TSTate bắt buộc mới (
    base->tp_traverse(self, visit, arg)
    
    06). (Được đóng góp bởi Victor Stinner trong BPO-38500.)PEP 523) now requires a new mandatory tstate parameter (
    base->tp_traverse(self, visit, arg)
    
    06). (Contributed by Victor Stinner in bpo-38500.)

  • Các mô -đun mở rộng: Các hàm

    base->tp_traverse(self, visit, arg)
    
    07,
    base->tp_traverse(self, visit, arg)
    
    08 và
    base->tp_traverse(self, visit, arg)
    
    09 của
    base->tp_traverse(self, visit, arg)
    
    10 không còn được gọi nếu trạng thái mô -đun được yêu cầu nhưng chưa được phân bổ. Đây là trường hợp ngay sau khi mô -đun được tạo và trước khi mô -đun được thực thi (hàm
    base->tp_traverse(self, visit, arg)
    
    11). Chính xác hơn, các chức năng này không được gọi nếu
    base->tp_traverse(self, visit, arg)
    
    12 lớn hơn 0 và trạng thái mô -đun (được trả về bởi
    base->tp_traverse(self, visit, arg)
    
    13) là
    base->tp_traverse(self, visit, arg)
    
    14.

    Các mô -đun mở rộng không có trạng thái mô -đun (

    base->tp_traverse(self, visit, arg)
    
    15) không bị ảnh hưởng.

  • Nếu

    base->tp_traverse(self, visit, arg)
    
    16 được gọi trong một trình điều khiển phụ, thì chức năng hiện được lên kế hoạch được gọi từ trình điều chỉnh con, thay vì được gọi từ trình thông dịch chính. Mỗi trình tạo con hiện có danh sách các cuộc gọi theo lịch trình riêng. (Được đóng góp bởi Victor Stinner trong BPO-39984.)

  • Sổ đăng ký Windows không còn được sử dụng để khởi tạo

    base->tp_traverse(self, visit, arg)
    
    17 khi tùy chọn
    int
    foo_traverse(foo_struct *self, visitproc visit, void *arg) {
    // Rest of the traverse function
    #if PY_VERSION_HEX >= 0x03090000
        // This was not needed before Python 3.9 (Python issue 35810 and 40217)
        Py_VISIT(Py_TYPE(self));
    #endif
    }
    
    12 được sử dụng (nếu
    base->tp_traverse(self, visit, arg)
    
    19 được đặt thành
    base->tp_traverse(self, visit, arg)
    
    20). Điều này rất có ý nghĩa khi nhúng Python vào Windows. (Được đóng góp bởi Zackery Spytz trong BPO-8901.)

  • Biến toàn cầu

    base->tp_traverse(self, visit, arg)
    
    21 hiện là một hằng số và đề cập đến một chuỗi không đổi. (Được đóng góp bởi Serhiy Storchaka trong BPO-38650.)

  • Cấu trúc

    base->tp_traverse(self, visit, arg)
    
    22 hiện mờ. Nó chỉ được xác định trong API C nội bộ (
    base->tp_traverse(self, visit, arg)
    
    23). (Được đóng góp bởi Victor Stinner trong BPO-40241.)

  • base->tp_traverse(self, visit, arg)
    
    24,
    base->tp_traverse(self, visit, arg)
    
    25,
    base->tp_traverse(self, visit, arg)
    
    26,
    base->tp_traverse(self, visit, arg)
    
    27,
    base->tp_traverse(self, visit, arg)
    
    28,
    base->tp_traverse(self, visit, arg)
    
    29 và
    base->tp_traverse(self, visit, arg)
    
    30 được đánh dấu là không dùng nữa trong C. Chúng đã bị mất bởi PEP 393 kể từ Python 3.3. (Được đóng góp bởi Inada Naoki trong BPO-36346.)PEP 393 since Python 3.3. (Contributed by Inada Naoki in bpo-36346.)

  • Hàm

    base->tp_traverse(self, visit, arg)
    
    31 được thay thế bằng một macro tự động ghi tên của hàm hiện tại, trừ khi macro
    int
    foo_traverse(foo_struct *self, visitproc visit, void *arg) {
    // Rest of the traverse function
    #if PY_VERSION_HEX >= 0x03090000
        // This was not needed before Python 3.9 (Python issue 35810 and 40217)
        Py_VISIT(Py_TYPE(self));
    #endif
    }
    
    94 được xác định. (Được đóng góp bởi Victor Stinner trong BPO-39882.)

  • Giao thức VectorCall hiện yêu cầu người gọi chỉ truyền các chuỗi dưới dạng tên từ khóa. (Xem BPO-37540 để biết thêm thông tin.)

  • Chi tiết triển khai của một số macro và chức năng hiện đang được ẩn:

    • Macro

      base->tp_traverse(self, visit, arg)
      
      33 đã được chuyển đổi thành một hàm.

    • Macro

      base->tp_traverse(self, visit, arg)
      
      34 trở thành bí danh của macro
      base->tp_traverse(self, visit, arg)
      
      35 và macro
      base->tp_traverse(self, visit, arg)
      
      36 trở thành bí danh của macro
      base->tp_traverse(self, visit, arg)
      
      37. Họ không còn truy cập trực tiếp thành viên
      base->tp_traverse(self, visit, arg)
      
      38.

    • Macro

      base->tp_traverse(self, visit, arg)
      
      39 đã được chuyển đổi thành một hàm: Macro truy cập trực tiếp thành viên
      base->tp_traverse(self, visit, arg)
      
      40.

    • Macro

      base->tp_traverse(self, visit, arg)
      
      41 đã được chuyển đổi thành một hàm: Macro truy cập trực tiếp thành viên ____542.

    • base->tp_traverse(self, visit, arg)
      
      43 hiện luôn được tuyên bố là hàm mờ để ẩn các chi tiết thực hiện: Đã xóa macro
      base->tp_traverse(self, visit, arg)
      
      43. Macro truy cập trực tiếp thành viên
      base->tp_traverse(self, visit, arg)
      
      45.

    (Xem BPO-40170 để biết thêm chi tiết.)

Loại bỏ¶

  • Loại trừ

    base->tp_traverse(self, visit, arg)
    
    46 và
    base->tp_traverse(self, visit, arg)
    
    47 macro của
    base->tp_traverse(self, visit, arg)
    
    48 từ API C giới hạn. (Được đóng góp bởi Victor Stinner trong BPO-38835.)

  • Khe

    base->tp_traverse(self, visit, arg)
    
    49 của pytypeObject đã bị loại bỏ. Nó được sử dụng để in các đối tượng vào các tệp trong Python 2.7 và trước đó. Kể từ Python 3.0, nó đã bị bỏ qua và không sử dụng. (Được đóng góp bởi Jeroen Demeyer trong BPO-36974.)PyTypeObject has been removed. It was used for printing objects to files in Python 2.7 and before. Since Python 3.0, it has been ignored and unused. (Contributed by Jeroen Demeyer in bpo-36974.)

  • Các thay đổi trong API C giới hạn (nếu

    int
    foo_traverse(foo_struct *self, visitproc visit, void *arg) {
    // Rest of the traverse function
    #if PY_VERSION_HEX >= 0x03090000
        // This was not needed before Python 3.9 (Python issue 35810 and 40217)
        Py_VISIT(Py_TYPE(self));
    #endif
    }
    
    94 macro được xác định):

    • Loại trừ các chức năng sau khỏi API C giới hạn:

      • base->tp_traverse(self, visit, arg)
        
        51 (Được đóng góp bởi Joannah Nanjekye trong BPO-37878.)

      • base->tp_traverse(self, visit, arg)
        
        52

      • base->tp_traverse(self, visit, arg)
        
        53

      • base->tp_traverse(self, visit, arg)
        
        54

      • base->tp_traverse(self, visit, arg)
        
        55

      • base->tp_traverse(self, visit, arg)
        
        56

      • Cơ chế rác không bao giờ hoạt động trong API C Limited.

      • base->tp_traverse(self, visit, arg)
        
        57

      • base->tp_traverse(self, visit, arg)
        
        58

      • base->tp_traverse(self, visit, arg)
        
        59

      • base->tp_traverse(self, visit, arg)
        
        60

      • base->tp_traverse(self, visit, arg)
        
        61

      • base->tp_traverse(self, visit, arg)
        
        62

    • Đã chuyển các chức năng và định nghĩa theo API nội bộ C:

      • base->tp_traverse(self, visit, arg)
        
        63

      • base->tp_traverse(self, visit, arg)
        
        64

      • base->tp_traverse(self, visit, arg)
        
        65

      • base->tp_traverse(self, visit, arg)
        
        66

      • base->tp_traverse(self, visit, arg)
        
        67 (Build dành riêng cho
        base->tp_traverse(self, visit, arg)
        
        68)

    (Được đóng góp bởi Victor Stinner trong BPO-38644 và BPO-39542.)

  • Đã loại bỏ

    base->tp_traverse(self, visit, arg)
    
    69 móc và loại bỏ macro
    base->tp_traverse(self, visit, arg)
    
    70 là bí danh của
    base->tp_traverse(self, visit, arg)
    
    69. Chúng chỉ được phơi bày bởi API C nội bộ. Đã loại bỏ cũng loại
    base->tp_traverse(self, visit, arg)
    
    72. (Được đóng góp bởi Victor Stinner trong BPO-39946.)

  • Đã loại bỏ các chức năng sau khỏi API C. Gọi

    base->tp_traverse(self, visit, arg)
    
    73 một cách rõ ràng để xóa tất cả các danh sách miễn phí. (Được đóng góp bởi Inada Naoki và Victor Stinner trong BPO-37340, BPO-38896 và BPO-40428.)

    • base->tp_traverse(self, visit, arg)
      
      74

    • base->tp_traverse(self, visit, arg)
      
      75

    • base->tp_traverse(self, visit, arg)
      
      76

    • base->tp_traverse(self, visit, arg)
      
      77

    • base->tp_traverse(self, visit, arg)
      
      78

    • base->tp_traverse(self, visit, arg)
      
      79

    • base->tp_traverse(self, visit, arg)
      
      80 và
      base->tp_traverse(self, visit, arg)
      
      81: Danh sách miễn phí của các đối tượng phương thức ràng buộc đã bị xóa.

    • base->tp_traverse(self, visit, arg)
      
      82: Danh sách miễn phí đã được xóa trong Python 3.4.

    • base->tp_traverse(self, visit, arg)
      
      83

    • base->tp_traverse(self, visit, arg)
      
      84: Danh sách miễn phí Unicode đã bị xóa trong Python 3.3.

  • Đã loại bỏ chức năng

    base->tp_traverse(self, visit, arg)
    
    85. (Được đóng góp bởi Victor Stinner trong BPO-39465.)

  • Đã loại bỏ

    base->tp_traverse(self, visit, arg)
    
    86. Nó đã bị phản đối bởi PEP 393 và bị hỏng kể từ Python 3.3. Hàm
    base->tp_traverse(self, visit, arg)
    
    87 có thể được sử dụng thay thế. (Được đóng góp bởi Inada Naoki trong BPO-36346.)PEP 393, and broken since Python 3.3. The
    base->tp_traverse(self, visit, arg)
    
    87 function can be used instead. (Contributed by Inada Naoki in bpo-36346.)

  • Các tập tin tiêu đề được làm sạch của các giao diện được xác định nhưng không có triển khai. Các biểu tượng API công khai đang bị xóa là:

    base->tp_traverse(self, visit, arg)
    
    88,
    base->tp_traverse(self, visit, arg)
    
    89,
    base->tp_traverse(self, visit, arg)
    
    90,
    base->tp_traverse(self, visit, arg)
    
    91,
    base->tp_traverse(self, visit, arg)
    
    92,
    base->tp_traverse(self, visit, arg)
    
    93,
    base->tp_traverse(self, visit, arg)
    
    94,
    base->tp_traverse(self, visit, arg)
    
    95,
    base->tp_traverse(self, visit, arg)
    
    96,
    base->tp_traverse(self, visit, arg)
    
    97, ____. (Được đóng góp bởi Pablo Galindo Salgado trong BPO-39372.)

Những thay đổi đáng chú ý trong Python 3.9.1¶

đánh máy¶

Hành vi của

#if PY_VERSION_HEX >= 0x03090000
    // This was not needed before Python 3.9 (bpo-35810 and bpo-40217)
    if (base->tp_flags & Py_TPFLAGS_HEAPTYPE) {
        // a heap type's tp_traverse already visited Py_TYPE(self)
    } else {
        Py_VISIT(Py_TYPE(self));
    }
#else
01 đã được thay đổi thành phù hợp với PEP 586 và để phù hợp với hành vi của các trình kiểm tra loại tĩnh được chỉ định trong PEP.PEP 586 and to match the behavior of static type checkers specified in the PEP.

  1. #if PY_VERSION_HEX >= 0x03090000
        // This was not needed before Python 3.9 (bpo-35810 and bpo-40217)
        if (base->tp_flags & Py_TPFLAGS_HEAPTYPE) {
            // a heap type's tp_traverse already visited Py_TYPE(self)
        } else {
            Py_VISIT(Py_TYPE(self));
        }
    #else
    
    02 Bây giờ khử trùng các tham số.

  2. So sánh bình đẳng giữa các đối tượng

    #if PY_VERSION_HEX >= 0x03090000
        // This was not needed before Python 3.9 (bpo-35810 and bpo-40217)
        if (base->tp_flags & Py_TPFLAGS_HEAPTYPE) {
            // a heap type's tp_traverse already visited Py_TYPE(self)
        } else {
            Py_VISIT(Py_TYPE(self));
        }
    #else
    
    02 hiện đang độc lập.

  3. #if PY_VERSION_HEX >= 0x03090000
        // This was not needed before Python 3.9 (bpo-35810 and bpo-40217)
        if (base->tp_flags & Py_TPFLAGS_HEAPTYPE) {
            // a heap type's tp_traverse already visited Py_TYPE(self)
        } else {
            Py_VISIT(Py_TYPE(self));
        }
    #else
    
    02 so sánh bây giờ các loại tôn trọng. Ví dụ,
    #if PY_VERSION_HEX >= 0x03090000
        // This was not needed before Python 3.9 (bpo-35810 and bpo-40217)
        if (base->tp_flags & Py_TPFLAGS_HEAPTYPE) {
            // a heap type's tp_traverse already visited Py_TYPE(self)
        } else {
            Py_VISIT(Py_TYPE(self));
        }
    #else
    
    05 đã được đánh giá trước đây là
    #if PY_VERSION_HEX >= 0x03090000
        // This was not needed before Python 3.9 (bpo-35810 and bpo-40217)
        if (base->tp_flags & Py_TPFLAGS_HEAPTYPE) {
            // a heap type's tp_traverse already visited Py_TYPE(self)
        } else {
            Py_VISIT(Py_TYPE(self));
        }
    #else
    
    06. Bây giờ là
    Python version                       3.4     3.5     3.6     3.7     3.8    3.9
    --------------                       ---     ---     ---     ---     ---    ---
    
    Variable and attribute read access:
        read_local                       7.1     7.1     5.4     5.1     3.9    3.9
        read_nonlocal                    7.1     8.1     5.8     5.4     4.4    4.5
        read_global                     15.5    19.0    14.3    13.6     7.6    7.8
        read_builtin                    21.1    21.6    18.5    19.0     7.5    7.8
        read_classvar_from_class        25.6    26.5    20.7    19.5    18.4   17.9
        read_classvar_from_instance     22.8    23.5    18.8    17.1    16.4   16.9
        read_instancevar                32.4    33.1    28.0    26.3    25.4   25.3
        read_instancevar_slots          27.8    31.3    20.8    20.8    20.2   20.5
        read_namedtuple                 73.8    57.5    45.0    46.8    18.4   18.7
        read_boundmethod                37.6    37.9    29.6    26.9    27.7   41.1
    
    Variable and attribute write access:
        write_local                      8.7     9.3     5.5     5.3     4.3    4.3
        write_nonlocal                  10.5    11.1     5.6     5.5     4.7    4.8
        write_global                    19.7    21.2    18.0    18.0    15.8   16.7
        write_classvar                  92.9    96.0   104.6   102.1    39.2   39.8
        write_instancevar               44.6    45.8    40.0    38.9    35.5   37.4
        write_instancevar_slots         35.6    36.1    27.3    26.6    25.7   25.8
    
    Data structure read access:
        read_list                       24.2    24.5    20.8    20.8    19.0   19.5
        read_deque                      24.7    25.5    20.2    20.6    19.8   20.2
        read_dict                       24.3    25.7    22.3    23.0    21.0   22.4
        read_strdict                    22.6    24.3    19.5    21.2    18.9   21.5
    
    Data structure write access:
        write_list                      27.1    28.5    22.5    21.6    20.0   20.0
        write_deque                     28.7    30.1    22.7    21.8    23.5   21.7
        write_dict                      31.4    33.3    29.3    29.2    24.7   25.4
        write_strdict                   28.4    29.9    27.5    25.2    23.1   24.5
    
    Stack (or queue) operations:
        list_append_pop                 93.4   112.7    75.4    74.2    50.8   50.6
        deque_append_pop                43.5    57.0    49.4    49.2    42.5   44.2
        deque_append_popleft            43.7    57.3    49.7    49.7    42.8   46.4
    
    Timing loop:
        loop_overhead                    0.5     0.6     0.4     0.3     0.3    0.3
    
    87. Để hỗ trợ thay đổi này, bộ đệm loại được sử dụng nội bộ hiện hỗ trợ các loại khác biệt.

  4. Các đối tượng

    #if PY_VERSION_HEX >= 0x03090000
        // This was not needed before Python 3.9 (bpo-35810 and bpo-40217)
        if (base->tp_flags & Py_TPFLAGS_HEAPTYPE) {
            // a heap type's tp_traverse already visited Py_TYPE(self)
        } else {
            Py_VISIT(Py_TYPE(self));
        }
    #else
    
    02 hiện sẽ tăng ngoại lệ os.pidfd_open()8 trong quá trình so sánh bình đẳng nếu bất kỳ tham số nào của chúng không thể băm. Lưu ý rằng việc khai báo
    #if PY_VERSION_HEX >= 0x03090000
        // This was not needed before Python 3.9 (bpo-35810 and bpo-40217)
        if (base->tp_flags & Py_TPFLAGS_HEAPTYPE) {
            // a heap type's tp_traverse already visited Py_TYPE(self)
        } else {
            Py_VISIT(Py_TYPE(self));
        }
    #else
    
    02 với các tham số có thể thay đổi sẽ không gây ra lỗi:hashable. Note that declaring
    #if PY_VERSION_HEX >= 0x03090000
        // This was not needed before Python 3.9 (bpo-35810 and bpo-40217)
        if (base->tp_flags & Py_TPFLAGS_HEAPTYPE) {
            // a heap type's tp_traverse already visited Py_TYPE(self)
        } else {
            Py_VISIT(Py_TYPE(self));
        }
    #else
    
    02 with mutable parameters will not throw an error:

    >>> from typing import Literal
    >>> Literal[{0}]
    >>> Literal[{0}] == Literal[{False}]
    Traceback (most recent call last):
      File "", line 1, in 
    TypeError: unhashable type: 'set'
    

(Được đóng góp bởi Yurii Karabas trong BPO-42345.)

MacOS 11.0 (Big Sur) và Apple Silicon Mac hỗ trợ

Tính đến 3.9.1, Python hiện hoàn toàn hỗ trợ việc xây dựng và chạy trên MacOS 11.0 (Big Sur) và trên Apple Silicon Macs (dựa trên kiến ​​trúc

#if PY_VERSION_HEX >= 0x03090000
    // This was not needed before Python 3.9 (bpo-35810 and bpo-40217)
    if (base->tp_flags & Py_TPFLAGS_HEAPTYPE) {
        // a heap type's tp_traverse already visited Py_TYPE(self)
    } else {
        Py_VISIT(Py_TYPE(self));
    }
#else
11). Một biến thể xây dựng phổ quát mới,
#if PY_VERSION_HEX >= 0x03090000
    // This was not needed before Python 3.9 (bpo-35810 and bpo-40217)
    if (base->tp_flags & Py_TPFLAGS_HEAPTYPE) {
        // a heap type's tp_traverse already visited Py_TYPE(self)
    } else {
        Py_VISIT(Py_TYPE(self));
    }
#else
12, hiện có sẵn để hỗ trợ tự nhiên cả
#if PY_VERSION_HEX >= 0x03090000
    // This was not needed before Python 3.9 (bpo-35810 and bpo-40217)
    if (base->tp_flags & Py_TPFLAGS_HEAPTYPE) {
        // a heap type's tp_traverse already visited Py_TYPE(self)
    } else {
        Py_VISIT(Py_TYPE(self));
    }
#else
11 và
#if PY_VERSION_HEX >= 0x03090000
    // This was not needed before Python 3.9 (bpo-35810 and bpo-40217)
    if (base->tp_flags & Py_TPFLAGS_HEAPTYPE) {
        // a heap type's tp_traverse already visited Py_TYPE(self)
    } else {
        Py_VISIT(Py_TYPE(self));
    }
#else
14 trong một bộ thực thi. Các nhị phân hiện cũng có thể được xây dựng trên các phiên bản macOS hiện tại sẽ được triển khai trên một loạt các phiên bản MacOS cũ hơn (được thử nghiệm đến 10.9) trong khi tạo ra một số chức năng HĐH mới hơn và các tùy chọn có điều kiện dựa trên phiên bản hệ điều hành được sử dụng trong thời gian chạy ( ).

(Được đóng góp bởi Ronald Oussoren và Lawrence DiênAna trong BPO-41100.)

Những thay đổi đáng chú ý trong Python 3.9.2¶

bộ sưu tập.abc¶

#if PY_VERSION_HEX >= 0x03090000
    // This was not needed before Python 3.9 (bpo-35810 and bpo-40217)
    if (base->tp_flags & Py_TPFLAGS_HEAPTYPE) {
        // a heap type's tp_traverse already visited Py_TYPE(self)
    } else {
        Py_VISIT(Py_TYPE(self));
    }
#else
15 Generic hiện đang làm phẳng các tham số loại, tương tự như những gì
#if PY_VERSION_HEX >= 0x03090000
    // This was not needed before Python 3.9 (bpo-35810 and bpo-40217)
    if (base->tp_flags & Py_TPFLAGS_HEAPTYPE) {
        // a heap type's tp_traverse already visited Py_TYPE(self)
    } else {
        Py_VISIT(Py_TYPE(self));
    }
#else
16 hiện đang làm. Điều này có nghĩa là
#if PY_VERSION_HEX >= 0x03090000
    // This was not needed before Python 3.9 (bpo-35810 and bpo-40217)
    if (base->tp_flags & Py_TPFLAGS_HEAPTYPE) {
        // a heap type's tp_traverse already visited Py_TYPE(self)
    } else {
        Py_VISIT(Py_TYPE(self));
    }
#else
17 sẽ có
#if PY_VERSION_HEX >= 0x03090000
    // This was not needed before Python 3.9 (bpo-35810 and bpo-40217)
    if (base->tp_flags & Py_TPFLAGS_HEAPTYPE) {
        // a heap type's tp_traverse already visited Py_TYPE(self)
    } else {
        Py_VISIT(Py_TYPE(self));
    }
#else
18 của
#if PY_VERSION_HEX >= 0x03090000
    // This was not needed before Python 3.9 (bpo-35810 and bpo-40217)
    if (base->tp_flags & Py_TPFLAGS_HEAPTYPE) {
        // a heap type's tp_traverse already visited Py_TYPE(self)
    } else {
        Py_VISIT(Py_TYPE(self));
    }
#else
19; Trước đây đây là
#if PY_VERSION_HEX >= 0x03090000
    // This was not needed before Python 3.9 (bpo-35810 and bpo-40217)
    if (base->tp_flags & Py_TPFLAGS_HEAPTYPE) {
        // a heap type's tp_traverse already visited Py_TYPE(self)
    } else {
        Py_VISIT(Py_TYPE(self));
    }
#else
20. Để cho phép thay đổi này,
#if PY_VERSION_HEX >= 0x03090000
    // This was not needed before Python 3.9 (bpo-35810 and bpo-40217)
    if (base->tp_flags & Py_TPFLAGS_HEAPTYPE) {
        // a heap type's tp_traverse already visited Py_TYPE(self)
    } else {
        Py_VISIT(Py_TYPE(self));
    }
#else
21 hiện có thể được phân nhóm và một lớp con sẽ được trả lại khi đăng ký loại
#if PY_VERSION_HEX >= 0x03090000
    // This was not needed before Python 3.9 (bpo-35810 and bpo-40217)
    if (base->tp_flags & Py_TPFLAGS_HEAPTYPE) {
        // a heap type's tp_traverse already visited Py_TYPE(self)
    } else {
        Py_VISIT(Py_TYPE(self));
    }
#else
15. Mã truy cập các đối số thông qua
#if PY_VERSION_HEX >= 0x03090000
    // This was not needed before Python 3.9 (bpo-35810 and bpo-40217)
    if (base->tp_flags & Py_TPFLAGS_HEAPTYPE) {
        // a heap type's tp_traverse already visited Py_TYPE(self)
    } else {
        Py_VISIT(Py_TYPE(self));
    }
#else
23 hoặc
#if PY_VERSION_HEX >= 0x03090000
    // This was not needed before Python 3.9 (bpo-35810 and bpo-40217)
    if (base->tp_flags & Py_TPFLAGS_HEAPTYPE) {
        // a heap type's tp_traverse already visited Py_TYPE(self)
    } else {
        Py_VISIT(Py_TYPE(self));
    }
#else
18 cần tính đến thay đổi này. A
Python version                       3.4     3.5     3.6     3.7     3.8    3.9
--------------                       ---     ---     ---     ---     ---    ---

Variable and attribute read access:
    read_local                       7.1     7.1     5.4     5.1     3.9    3.9
    read_nonlocal                    7.1     8.1     5.8     5.4     4.4    4.5
    read_global                     15.5    19.0    14.3    13.6     7.6    7.8
    read_builtin                    21.1    21.6    18.5    19.0     7.5    7.8
    read_classvar_from_class        25.6    26.5    20.7    19.5    18.4   17.9
    read_classvar_from_instance     22.8    23.5    18.8    17.1    16.4   16.9
    read_instancevar                32.4    33.1    28.0    26.3    25.4   25.3
    read_instancevar_slots          27.8    31.3    20.8    20.8    20.2   20.5
    read_namedtuple                 73.8    57.5    45.0    46.8    18.4   18.7
    read_boundmethod                37.6    37.9    29.6    26.9    27.7   41.1

Variable and attribute write access:
    write_local                      8.7     9.3     5.5     5.3     4.3    4.3
    write_nonlocal                  10.5    11.1     5.6     5.5     4.7    4.8
    write_global                    19.7    21.2    18.0    18.0    15.8   16.7
    write_classvar                  92.9    96.0   104.6   102.1    39.2   39.8
    write_instancevar               44.6    45.8    40.0    38.9    35.5   37.4
    write_instancevar_slots         35.6    36.1    27.3    26.6    25.7   25.8

Data structure read access:
    read_list                       24.2    24.5    20.8    20.8    19.0   19.5
    read_deque                      24.7    25.5    20.2    20.6    19.8   20.2
    read_dict                       24.3    25.7    22.3    23.0    21.0   22.4
    read_strdict                    22.6    24.3    19.5    21.2    18.9   21.5

Data structure write access:
    write_list                      27.1    28.5    22.5    21.6    20.0   20.0
    write_deque                     28.7    30.1    22.7    21.8    23.5   21.7
    write_dict                      31.4    33.3    29.3    29.2    24.7   25.4
    write_strdict                   28.4    29.9    27.5    25.2    23.1   24.5

Stack (or queue) operations:
    list_append_pop                 93.4   112.7    75.4    74.2    50.8   50.6
    deque_append_pop                43.5    57.0    49.4    49.2    42.5   44.2
    deque_append_popleft            43.7    57.3    49.7    49.7    42.8   46.4

Timing loop:
    loop_overhead                    0.5     0.6     0.4     0.3     0.3    0.3
7 có thể được phát ra cho các hình thức tham số hóa không hợp lệ
#if PY_VERSION_HEX >= 0x03090000
    // This was not needed before Python 3.9 (bpo-35810 and bpo-40217)
    if (base->tp_flags & Py_TPFLAGS_HEAPTYPE) {
        // a heap type's tp_traverse already visited Py_TYPE(self)
    } else {
        Py_VISIT(Py_TYPE(self));
    }
#else
15 có thể đã được thông qua âm thầm trong Python 3.9.1.
Python version                       3.4     3.5     3.6     3.7     3.8    3.9
--------------                       ---     ---     ---     ---     ---    ---

Variable and attribute read access:
    read_local                       7.1     7.1     5.4     5.1     3.9    3.9
    read_nonlocal                    7.1     8.1     5.8     5.4     4.4    4.5
    read_global                     15.5    19.0    14.3    13.6     7.6    7.8
    read_builtin                    21.1    21.6    18.5    19.0     7.5    7.8
    read_classvar_from_class        25.6    26.5    20.7    19.5    18.4   17.9
    read_classvar_from_instance     22.8    23.5    18.8    17.1    16.4   16.9
    read_instancevar                32.4    33.1    28.0    26.3    25.4   25.3
    read_instancevar_slots          27.8    31.3    20.8    20.8    20.2   20.5
    read_namedtuple                 73.8    57.5    45.0    46.8    18.4   18.7
    read_boundmethod                37.6    37.9    29.6    26.9    27.7   41.1

Variable and attribute write access:
    write_local                      8.7     9.3     5.5     5.3     4.3    4.3
    write_nonlocal                  10.5    11.1     5.6     5.5     4.7    4.8
    write_global                    19.7    21.2    18.0    18.0    15.8   16.7
    write_classvar                  92.9    96.0   104.6   102.1    39.2   39.8
    write_instancevar               44.6    45.8    40.0    38.9    35.5   37.4
    write_instancevar_slots         35.6    36.1    27.3    26.6    25.7   25.8

Data structure read access:
    read_list                       24.2    24.5    20.8    20.8    19.0   19.5
    read_deque                      24.7    25.5    20.2    20.6    19.8   20.2
    read_dict                       24.3    25.7    22.3    23.0    21.0   22.4
    read_strdict                    22.6    24.3    19.5    21.2    18.9   21.5

Data structure write access:
    write_list                      27.1    28.5    22.5    21.6    20.0   20.0
    write_deque                     28.7    30.1    22.7    21.8    23.5   21.7
    write_dict                      31.4    33.3    29.3    29.2    24.7   25.4
    write_strdict                   28.4    29.9    27.5    25.2    23.1   24.5

Stack (or queue) operations:
    list_append_pop                 93.4   112.7    75.4    74.2    50.8   50.6
    deque_append_pop                43.5    57.0    49.4    49.2    42.5   44.2
    deque_append_popleft            43.7    57.3    49.7    49.7    42.8   46.4

Timing loop:
    loop_overhead                    0.5     0.6     0.4     0.3     0.3    0.3
7 này sẽ trở thành os.pidfd_open()8 trong Python 3.10. (Được đóng góp bởi Ken Jin trong BPO-42195.)

Urllib.parse¶

Các phiên bản Python trước đó cho phép sử dụng cả

#if PY_VERSION_HEX >= 0x03090000
    // This was not needed before Python 3.9 (bpo-35810 and bpo-40217)
    if (base->tp_flags & Py_TPFLAGS_HEAPTYPE) {
        // a heap type's tp_traverse already visited Py_TYPE(self)
    } else {
        Py_VISIT(Py_TYPE(self));
    }
#else
29 và
#if PY_VERSION_HEX >= 0x03090000
    // This was not needed before Python 3.9 (bpo-35810 and bpo-40217)
    if (base->tp_flags & Py_TPFLAGS_HEAPTYPE) {
        // a heap type's tp_traverse already visited Py_TYPE(self)
    } else {
        Py_VISIT(Py_TYPE(self));
    }
#else
30 làm dấu phân cách tham số truy vấn trong
#if PY_VERSION_HEX >= 0x03090000
    // This was not needed before Python 3.9 (bpo-35810 and bpo-40217)
    if (base->tp_flags & Py_TPFLAGS_HEAPTYPE) {
        // a heap type's tp_traverse already visited Py_TYPE(self)
    } else {
        Py_VISIT(Py_TYPE(self));
    }
#else
31 và
#if PY_VERSION_HEX >= 0x03090000
    // This was not needed before Python 3.9 (bpo-35810 and bpo-40217)
    if (base->tp_flags & Py_TPFLAGS_HEAPTYPE) {
        // a heap type's tp_traverse already visited Py_TYPE(self)
    } else {
        Py_VISIT(Py_TYPE(self));
    }
#else
32. Do các mối quan tâm về bảo mật và để phù hợp với các đề xuất W3C mới hơn, điều này đã được thay đổi để chỉ cho phép một phím phân tách duy nhất, với
#if PY_VERSION_HEX >= 0x03090000
    // This was not needed before Python 3.9 (bpo-35810 and bpo-40217)
    if (base->tp_flags & Py_TPFLAGS_HEAPTYPE) {
        // a heap type's tp_traverse already visited Py_TYPE(self)
    } else {
        Py_VISIT(Py_TYPE(self));
    }
#else
30 làm mặc định. Thay đổi này cũng ảnh hưởng đến
#if PY_VERSION_HEX >= 0x03090000
    // This was not needed before Python 3.9 (bpo-35810 and bpo-40217)
    if (base->tp_flags & Py_TPFLAGS_HEAPTYPE) {
        // a heap type's tp_traverse already visited Py_TYPE(self)
    } else {
        Py_VISIT(Py_TYPE(self));
    }
#else
34 và
#if PY_VERSION_HEX >= 0x03090000
    // This was not needed before Python 3.9 (bpo-35810 and bpo-40217)
    if (base->tp_flags & Py_TPFLAGS_HEAPTYPE) {
        // a heap type's tp_traverse already visited Py_TYPE(self)
    } else {
        Py_VISIT(Py_TYPE(self));
    }
#else
35 khi họ sử dụng các chức năng bị ảnh hưởng trong nội bộ. Để biết thêm chi tiết, xin vui lòng xem tài liệu tương ứng của họ. (Được đóng góp bởi Adam Goldschmidt, Senthil Kumaran và Ken Jin trong BPO-42967.)

Python 3.9 có tương thích ngược không?

Python 3.9 là phiên bản cuối cùng cung cấp các lớp tương thích ngược Python 2 đó, để dành nhiều thời gian hơn cho các dự án Python để tổ chức việc loại bỏ hỗ trợ Python 2 và thêm hỗ trợ cho Python 3.9., to give more time to Python projects maintainers to organize the removal of the Python 2 support and add support for Python 3.9.

Python 3.6 có bị phản đối không?

Sau khi phát hành Python 3.9, Vercel đang phản đối sự hỗ trợ cho Python 3.6 đã kết thúc cuộc đời năm ngoái.Vào ngày 18 tháng 7 năm 2022, các triển khai mới nhắm mục tiêu Python 3.6 sẽ thất bại với một thông báo lỗi.Triển khai hiện tại sẽ không bị ảnh hưởng.

Python 3.9 có tốt hơn không?

Mỗi bản sửa đổi của Python đều được cải thiện hiệu suất so với phiên bản trước.Python 3.9 cuộn trong hai cải tiến lớn giúp tăng hiệu suất mà không yêu cầu bất kỳ thay đổi nào đối với mã hiện có.Cải tiến đầu tiên liên quan đến việc sử dụng nhiều giao thức VectorCall được giới thiệu trong Python 3.8.Python 3.9 rolls in two big improvements that boost performance without requiring any changes to existing code. The first improvement involves more use of the vectorcall protocol introduced in Python 3.8.