##language:zh #pragma section-numbers off ##含有章节索引导航的 ZPyUG 文章通用模板 <> ## 默许导航,请保留 <> = Bottle推介~简洁的直观对比 = [[http://simple-is-better.com/news/detail-55|Bottle 项目推介:义乌小额批发搜索引擎 - Bottle - python.cn(jobs, news)]] 引发... ##startInc == 老光 == {{{ 老光 发件人当地时间 发送时间 08:57 (GMT+08:00)。发送地当前时间:上午9:43。 ✆ 回复 python-cn@googlegroups.com 发送至 python-cn@googlegroups.com 日期 2010年11月9日 上午8:57 主题 Re: [CPyUG] Re: Bottle 项目推介:义乌小额批发搜索引擎 }}} 忍不住回一句,到底什么叫简洁? {{{#!python from bottle import Bottle, run, mako_view, request myapp = Bottle() @myapp.get('/hello/:name/:count#\\d+#') @mako_view('hello') def hello(name, count): ip = request.environ.get('REMOTE_ADDR') return dict(n=name, c=int(count), ip=ip) run(app=myapp) }}} 我凡是看到大多数框架,看到这种一个简单的"hello world"要写七八行以上的,就觉得头疼;而且比如上面的一段代码,一眼看完后,不知道最后执行的run(app=myapp),与hello是怎么关联上的. 我们看Karrigell.py的hello示例,理解什么叫简洁: {{{#!python print "Hello world" }}} 我只能够接受到eurasia的hello例子,虽然他行数也很多: {{{#!python #!/usr/bin/python2.5 from eurasia import config, mainloop def handler(httpfile): httpfile['Content-Type'] = 'text/html' httpfile.write('hello world!') httpfile.close() config(handler=handler, port=8080) mainloop() }}} 这导致我在django等框架里入不了门... ##endInc ---- '''反馈''' 创建 by -- ZoomQuiet [<>]