才发现 Python 被和谐了
昨天在研究了几天PHP-GTK后,决定转向Python,因为Python具有多线程这个特点,在与系统交互方面也比较有优势,虽然我很喜欢PHP,PHP在网页方面也非常强大,但毕竟我不是搞网站开发的。
想下个Python吧,发现它居然被和谐了,太诡异了
唉,和谐有理,屏蔽无罪!
相关文档:
And last here is the overload operators example:
# map() takes two (or more) arguments, a function and a list to apply the function to
# lambda can be put anywhere a function is expected
# map() calls lambada for every element in the self list
# since Vector has overloaded __getitem__ and __len_ ......
# 直接插入排序
def InsertSort(mylist):
size = len(mylist)
i = 1
for i in range(1, size):
if mylist[i] < mylist[i - 1]:
tmp = mylist[i]
j = i - 1
mylist[j + 1] = mylist[j]
j = j - 1
while j > ......
#直接选择排序
def SelectSort(mylist):
size = len(mylist)
i = 0
for i in range(0, size):
k = i
for j in range(i + 1, size):
if mylist[j] < mylist[k]:
k = j
if k != i:
tmp = mylist[i]
......
#使用类
class CPerson:
#类变量好比C++中的静态成员变量
population = 0
def SayHi(self):
print('Hello World')
def HowMany(self):
if CPerson.population == 1:
print('I am the only person here.')
else:
print(('We have %d perso ......