[py]a python tutor

//python设计哲学

In [5]: import this
The Zen of Python, by Tim Peters

Beautiful is better than ugly.
Explicit is better than implicit.
Simple is better than complex.
Complex is better than complicated.
Flat is better than nested.
Sparse is better than dense.
Readability counts.
Special cases aren't special enough to break the rules.
Although practicality beats purity.
Errors should never pass silently.
Unless explicitly silenced.
In the face of ambiguity, refuse the temptation to guess.
There should be one-- and preferably only one --obvious way to do it.
Although that way may not be obvious at first unless you're Dutch.
Now is better than never.
Although never is often better than *right* now.
If the implementation is hard to explain, it's a bad idea.
If the implementation is easy to explain, it may be a good idea.
Namespaces are one honking great idea -- let's do more of those!
用一些特殊标识来约定(自觉遵守,不要求强制)
    常量定义: WEEKDAY = 8
    类中权限保护: 方法名前加 __
// buildins.py里的函数(体现py面向过程)

abs
all
any
ascii
bin
callable
chr
compile
copyright
credits
delattr
dir         # 函数不带参数时,返回当前范围内的(变量/类型/对象)列表; 带参数(变量/类型/对象)时,返回参数的属性、方法列表。
divmod
eval
exec
exit
format
getattr
globals
hasattr
hash
help
hex
id          # cpython中取的是内存地址
input
isinstance
issubclass
iter
len
license
locals
max
min
next
oct
open
ord
pow
print
quit
repr
round
setattr
sorted
sum
vars
__build_class__
__import__
// buildins.py里的类(体现py面向对象)

class object:
class type(object)
    type(object_or_name, bases, dict)
    type(object) -> the object's type
    type(name, bases, dict) -> a new type

class int(object)
class bool(object)
class str(object)

class tuple(object)
class list(object)
class dict(object)



class enumerate(object):

猜你喜欢

转载自www.cnblogs.com/iiiiiher/p/12344608.html