页游开发中的 Python 组件与模式
赖勇浩()
2012-10-21
去年我来过……
回顾……
幻灯:yonghao/python-webgame-10452102
录像(上海45分钟版):http://e./v_3df867_14
录像(广州91分钟版):http://v./v_playlist/
偏向于“最佳实践”的经验分享
今天不一样……
直奔主题!
class Player(object):
def signin(self, usr, pwd):
...
= True
def do_sth(self):
if not :
()
return
...
有什么问题?
def do_sth_1(...
def do_sth_2(...
def do_sth_3(...
def do_sth_4(...
…
一般这样解决掉……
***@ensure_signin
def do_sth(self, *a, **kw):
…
Decorator !!!
还有什么问题?
def do_sth_1(...
def do_sth_2(...
def do_sth_3(...
def do_sth_4(...
…
if not : ...
if not : ...
if not : ...
...
还是这样解决掉?
***@ensure_signin
***@ensure_in_battle
***@ensuer_is_alive
def do_sth(self, *a, **kw):
…
???
好像哪里不对……
戴太多“帽子”不好看
method 的数量没有减少。
需要一点新思路!
页游开发中的Python 组件与模式 来自淘豆网m.daumloan.com转载请标明出处.