日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程语言 > python >内容正文

python

python3.7.1使用_在不影响使用python3.7.1的功能的情况下,是否可以从python代码中删除所有的ufuture_uu语句?...

發布時間:2024/7/5 python 28 豆豆
生活随笔 收集整理的這篇文章主要介紹了 python3.7.1使用_在不影响使用python3.7.1的功能的情况下,是否可以从python代码中删除所有的ufuture_uu语句?... 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

您可以在不影響功能的情況下刪除那些__future__導入,但是刪除它們不是必需的,并且會停止與早期python版本的兼容性。在

此外,正如@deceze在評論中所暗示的那樣,其他進口商品可能有所不同。例如,from __future__ import annotations在Python<=4.0中是only enabled,因此添加/刪除該行將影響功能:Since this change breaks compatibility, the new behavior needs to be

enabled on a per-module basis in Python 3.7 using a __future__ import:

from __future__ import annotations

It will become the default in Python 4.0.

正如@jmd_dk指出的,您實際上可以在__future__模塊中找到這些信息。我寫了一個簡短的腳本來摘錄:import __future__

import ast

import sys

print('Python version:', sys.version_info)

sys_t = sys.version_info[:3]

s = '__future__ import {} {} for you; the version: {} vs. your version: {}'

for name in __future__.all_feature_names:

optional, mandatory, _ = ast.literal_eval(str(getattr(__future__, name)).lstrip('_Featur'))

optional, mandatory = optional[:3], mandatory[:3]

print('\nName: {}'.format(name))

tmp = [None, None, optional, sys_t]

if optional <= sys_t:

tmp[:2] = 'is', 'included'

else:

tmp[:2] = 'not', 'included'

print(s.format(*tmp))

tmp[2] = mandatory

if mandatory <= sys_t:

tmp[:2] = 'is', 'fixed'

else:

tmp[:2] = 'not', 'fixed'

print(s.format(*tmp))

在我的系統上,它輸出:

^{pr2}$

當Python&gt;=3.8引入了__future__導入(在我編寫本文時還沒有引入),刪除這些導入并在python3.7上運行顯然會影響功能。在

總結

以上是生活随笔為你收集整理的python3.7.1使用_在不影响使用python3.7.1的功能的情况下,是否可以从python代码中删除所有的ufuture_uu语句?...的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。