python 使用property为什么要定义私有?



                    
                    
张轶群123
13455 次浏览 2024-05-10 提问
52

最新回答 (2条回答)

2024-05-10 回答

内置函数在概念上并没有唯一专指。 ============= 但在其他语言,可以直接调用。这些函数不属于任何类或模块,内置函数的具体含义不同、其他环境下。 用户自定义扩充的函数也不属于内置。近似于关键字。 abs() dict() help() min() setattr() all() dir() hex() next() slice() any() divmod() id() object() sorted() ascii() enumerate() input() oct() staticmethod() bin() eval() int() open() str() bool() exec() isinstance() ord() sum() bytearray() filter() issubclass() pow() super() bytes() float() iter() print() tuple() callable() format() len() property() type() chr() frozenset() list() range() vars() classmethod() getattr() locals() repr() zip() compile() globals() map() reversed() __import__() complex() hasattr() max() round() delattr() hash() memoryview() set() 标准库中其他模块内的静态方法等不属于内置函数,可以看成python语言不可分割的一部分吧python的内置函数built-in function是指在标准库standard library中的内置函数,是合成词

2024-05-10 回答

内置函数在概念上并没有唯一专指。 ============= 但在其他语言,可以直接调用。这些函数不属于任何类或模块,内置函数的具体含义不同、其他环境下。 用户自定义扩充的函数也不属于内置。近似于关键字。 abs() dict() help() min() setattr() all() dir() hex() next() slice() any() divmod() id() object() sorted() ascii() enumerate() input() oct() staticmethod() bin() eval() int() open() str() bool() exec() isinstance() ord() sum() bytearray() filter() issubclass() pow() super() bytes() float() iter() print() tuple() callable() format() len() property() type() chr() frozenset() list() range() vars() classmethod() getattr() locals() repr() zip() compile() globals() map() reversed() __import__() complex() hasattr() max() round() delattr() hash() memoryview() set() 标准库中其他模块内的静态方法等不属于内置函数,可以看成python语言不可分割的一部分吧python的内置函数built-in function是指在标准库standard library中的内置函数,是合成词

扩展回答

在python里如何使用装饰器

# -*- coding: utf-8 -*-
#coding:UTF-8

def FirstDeco(func):
print u'第一个装饰器'
#if 1>0:return True
return func
@供怠垛干艹妨讹施番渐FirstDeco
def test0():
if 1>0:return True #这条判断语句很多地方要用到,如何抽取出来用一个函数装饰器包装起来用。

print 'test0'
def test1():
print 'test1'
test0()
test1()
#只要输出 test1

相关问题

页面运行时间: 0.03902006149292 秒