使用python单词“type"是否安全?在我的代码中? [英] Is it safe to use the python word "type" in my code?
本文介绍了使用python单词“type"是否安全?在我的代码中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我可以在自己的代码中使用type
这个词还是保留这个词?我的函数头:
Can I use the word type
in my own code or is it reserved? My function header:
def get(
self,
region='Delhi',
city='Delhi',
category='Apartments',
type='For sale',
limit=60,
PAGESIZE=5,
year=2012,
month=1,
day=1,
next_page=None,
threetapspage=0,
):
推荐答案
使用 type
作为函数的关键字参数将掩盖 内置函数"type" 函数范围内.因此,虽然这样做不会引发 SyntaxError
,但它不被认为是好的做法,我会避免这样做.
Using type
as a keyword argument to a function will mask the built-in function "type" within the scope of the function. So while doing so does not raise a SyntaxError
, it is not considered good practice, and I would avoid doing so.
这篇关于使用python单词“type"是否安全?在我的代码中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文