Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Python在豆瓣的应用

19,006 views

Published on

@ PyCon China 2011

Published in: Technology
  • PumaToto | Agen Togel Terpercaya PumaToto merupakan Togel Online | Togel Terpercaya dengan Prediksi Togel Akurat | Prediksi Angka Jitu Bagi kalian yang suka bermain Togel Singapore | Togel HK bisa untuk bergabung dengan PumaToto Cara Main Togel | Cara Pasang Togel | Pasang Togel Online di PumaToto, dengan Discount dan Hadiah Menarik Tentunya Daftarkan diri Anda bersama PumaToto https://caramaintogel.com/
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • Sex in your area is here: ♥♥♥ http://bit.ly/2Qu6Caa ♥♥♥
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • Dating for everyone is here: ♥♥♥ http://bit.ly/2Qu6Caa ♥♥♥
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • DOWNLOAD THAT BOOKS INTO AVAILABLE FORMAT (2019 Update) ......................................................................................................................... ......................................................................................................................... Download Full PDF EBOOK here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download Full EPUB Ebook here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download Full doc Ebook here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download PDF EBOOK here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download EPUB Ebook here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download doc Ebook here { http://bit.ly/2m6jJ5M } ......................................................................................................................... ......................................................................................................................... ................................................................................................................................... eBook is an electronic version of a traditional print book that can be read by using a personal computer or by using an eBook reader. (An eBook reader can be a software application for use on a computer such as Microsoft's free Reader application, or a book-sized computer that is used solely as a reading device such as Nuvomedia's Rocket eBook.) Users can purchase an eBook on diskette or CD, but the most popular method of getting an eBook is to purchase a downloadable file of the eBook (or other reading material) from a Web site (such as Barnes and Noble) to be read from the user's computer or reading device. Generally, an eBook can be downloaded in five minutes or less ......................................................................................................................... .............. Browse by Genre Available eBooks .............................................................................................................................. Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, ......................................................................................................................... ......................................................................................................................... .....BEST SELLER FOR EBOOK RECOMMEND............................................................. ......................................................................................................................... Blowout: Corrupted Democracy, Rogue State Russia, and the Richest, Most Destructive Industry on Earth,-- The Ride of a Lifetime: Lessons Learned from 15 Years as CEO of the Walt Disney Company,-- Call Sign Chaos: Learning to Lead,-- StrengthsFinder 2.0,-- Stillness Is the Key,-- She Said: Breaking the Sexual Harassment Story That Helped Ignite a Movement,-- Atomic Habits: An Easy & Proven Way to Build Good Habits & Break Bad Ones,-- Everything Is Figureoutable,-- What It Takes: Lessons in the Pursuit of Excellence,-- Rich Dad Poor Dad: What the Rich Teach Their Kids About Money That the Poor and Middle Class Do Not!,-- The Total Money Makeover: Classic Edition: A Proven Plan for Financial Fitness,-- Shut Up and Listen!: Hard Business Truths that Will Help You Succeed, ......................................................................................................................... .........................................................................................................................
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • DOWNLOAD THAT BOOKS INTO AVAILABLE FORMAT (2019 Update) ......................................................................................................................... ......................................................................................................................... Download Full PDF EBOOK here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download Full EPUB Ebook here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download Full doc Ebook here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download PDF EBOOK here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download EPUB Ebook here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download doc Ebook here { http://bit.ly/2m6jJ5M } ......................................................................................................................... ......................................................................................................................... ................................................................................................................................... eBook is an electronic version of a traditional print book that can be read by using a personal computer or by using an eBook reader. (An eBook reader can be a software application for use on a computer such as Microsoft's free Reader application, or a book-sized computer that is used solely as a reading device such as Nuvomedia's Rocket eBook.) Users can purchase an eBook on diskette or CD, but the most popular method of getting an eBook is to purchase a downloadable file of the eBook (or other reading material) from a Web site (such as Barnes and Noble) to be read from the user's computer or reading device. Generally, an eBook can be downloaded in five minutes or less ......................................................................................................................... .............. Browse by Genre Available eBooks .............................................................................................................................. Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, ......................................................................................................................... ......................................................................................................................... .....BEST SELLER FOR EBOOK RECOMMEND............................................................. ......................................................................................................................... Blowout: Corrupted Democracy, Rogue State Russia, and the Richest, Most Destructive Industry on Earth,-- The Ride of a Lifetime: Lessons Learned from 15 Years as CEO of the Walt Disney Company,-- Call Sign Chaos: Learning to Lead,-- StrengthsFinder 2.0,-- Stillness Is the Key,-- She Said: Breaking the Sexual Harassment Story That Helped Ignite a Movement,-- Atomic Habits: An Easy & Proven Way to Build Good Habits & Break Bad Ones,-- Everything Is Figureoutable,-- What It Takes: Lessons in the Pursuit of Excellence,-- Rich Dad Poor Dad: What the Rich Teach Their Kids About Money That the Poor and Middle Class Do Not!,-- The Total Money Makeover: Classic Edition: A Proven Plan for Financial Fitness,-- Shut Up and Listen!: Hard Business Truths that Will Help You Succeed, ......................................................................................................................... .........................................................................................................................
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here

Python在豆瓣的应用

  1. 1. Python 应 2011.12
  2. 2. About Me• / hongqn• 2002 Python• 2004 Python• 2006 现 构师• http://www.douban.com/ people/hongqn/
  3. 3. Python and Douban
  4. 4. Python in Douban
  5. 5. 协 发环
  6. 6. 协 发环+
  7. 7. 协 发环+ +
  8. 8. 协 发环 Face to Face ++ +
  9. 9. 术团队 动 发 术 产 发QA
  10. 10. 动 发 术 产 发QA
  11. 11. Mako
  12. 12. Mako• A very fast template engine
  13. 13. Mako• A very fast template engine• Mako IS Python
  14. 14. 态 处static(): 动处 态 URL <link href="${static(/css/douban.css)}" rel="stylesheet" type="text/css">
  15. 15. 态 处static(): 动处 态 URL <link href="${static(/css/douban.css)}" rel="stylesheet" type="text/css"> 发环 http://dev.douban.com/css/douban.css
  16. 16. 态 处static(): 动处 态 URL <link href="${static(/css/douban.css)}" rel="stylesheet" type="text/css"> 发环 http://dev.douban.com/css/douban.css线 环 http://img3.douban.com/css/packed_douban9922754105.css
  17. 17. 联...html code....<script>${istatic(/js/sns/tribe/manage_members.js)|n}</script>
  18. 18. 预编译@import
  19. 19. 预编译@import pyScss
  20. 20. 动 发 术 产 发QA
  21. 21. APNS Agent
  22. 22. APNS Agent• 应 Apple Push Notification Service (APNS) 讯
  23. 23. APNS Agent• 应 Apple Push Notification Service (APNS) 讯• gevent
  24. 24. APNS Agent• 应 Apple Push Notification Service (APNS) 讯• gevent• bottle
  25. 25. APNS Agent• 应 Apple Push Notification Service (APNS) 讯• gevent• bottle• APNSWrapper
  26. 26. 动 发 术 产 发QA
  27. 27. Quixote
  28. 28. Quixote• Pretty old (we are using version 1.2)
  29. 29. Quixote• Pretty old (we are using version 1.2)• Simple
  30. 30. Quixote• Pretty old (we are using version 1.2)• Simple• Fast
  31. 31. Quixote• Pretty old (we are using version 1.2)• Simple• Fast• Stable
  32. 32. Quixote• Pretty old (we are using version 1.2)• Simple• Fast• Stable• Traversal based
  33. 33. Traversalhttp://www.douban.com/group/python/members
  34. 34. Traversalhttp://www.douban.com/group/python/members /
  35. 35. Traversalhttp://www.douban.com/group/python/members / import luz.group group
  36. 36. Traversalhttp://www.douban.com/group/python/members / import luz.group group _q_lookup(request, python) python
  37. 37. Traversalhttp://www.douban.com/group/python/members / import luz.group group _q_lookup(request, python) python .members(request) members
  38. 38. Traversalhttp://www.douban.com/group/python/members / import luz.group group _q_lookup(request, python) python ._q_access(request) .members(request) members
  39. 39. Traversalhttp://www.douban.com/group/python/members / import luz.group group raise DeletedGroupError _q_lookup(request, python)
  40. 40. Traversalhttp://www.douban.com/group/python/members / import luz.group group raise DeletedGroupError _q_lookup(request, python) _q_exception_handler(request, e)
  41. 41. Traversalhttp://www.douban.com/group/python/members / import luz.group group raise DeletedGroupError _q_lookup(request, python) _q_exception_handler(request, e) route based url dispatch 录级 进
  42. 42. Decorators@need_post@require_login@check_switch(annotation)@check_permission(admin)@jsonizedef preview(self, request):
  43. 43. Generators
  44. 44. Generatorsfeed feed feed
  45. 45. Generatorsfeed feed feed iterator iterator iterator
  46. 46. Generatorsfeed feed feed iterator iterator iterator imerge iterator
  47. 47. Generatorsfeed feed feed iterator iterator iterator imerge iterator pager list
  48. 48. Meta Programmingclass MetaPage(object): __metaclass__ = MetaObserverclass Vote(Commentable, MetaPage): kind = K_VOTE kind_name = voteassert MetaObserver.get_class_by_name(vote) is Vote
  49. 49. OneRing • Build Desktop Application Using Web Technology • HTML5 + CSS + JS • WebKit + Qt + Python
  50. 50. 动 发 术 产 发QA
  51. 51. Restful MongoDB Service• 给 业 储• django-piston• sleepy
  52. 52. 动 发 术 产 发QA
  53. 53. pylint • 码 态检查 • SQL inject 检查 • XSS 检查
  54. 54. onimaru • 错误 统 • Based on django-sentry
  55. 55. release manager • 动 tag • 认测试结 •发 线报 • django powered
  56. 56. 动 发 术 产 发QA
  57. 57. cmy - MySQL Client• MySQL 户 Python/C API编• select 语•• 访问时 python对• 时 MySQLdb
  58. 58. C++ Intergration • cos_sim load_data.pydef load(): for user, subject, rating in CmyResult( "select user_id, subject_id, rating from user_interest"): cos_sim_io.add_edge(user, subject, rating) Python 载 C++计
  59. 59. 动 发 术 产 发QA
  60. 60. Online Profiler 12164 function calls (12109 primitive calls) in 0.250 CPU secondsOrdered by: internal time, call countList reduced from 274 to 60 due to restriction <60>ncalls tottime percall cumtime percall filename:lineno(function) 1000 0.098 0.000 0.098 0.000 cmemcached.py:22(restore) 61 0.064 0.001 0.070 0.001 cmemcached.py:64(get) 14 0.026 0.002 0.121 0.009 cmemcached.py:68(get_multi) 908 0.010 0.000 0.017 0.000 decorator.py:22(gen_key) 908 0.005 0.000 0.033 0.000 decorator.py:39(_) 67 0.004 0.000 0.199 0.003 debug.py:26(_) 898 0.004 0.000 0.004 0.000 format.py:57(_) 953 0.003 0.000 0.095 0.000 cmemcached.py:70(<genexpr>) 1 0.003 0.003 0.149 0.149 __init__.py:1866(get_loc_period_events) 908 0.002 0.000 0.007 0.000 format.py:10(format) 2 0.002 0.001 0.143 0.071 __init__.py:346(gets) 963 0.002 0.000 0.075 0.000 wrapper.py:138(get) 67 0.001 0.000 0.001 0.000 debug.py:36(format_call) 878 0.001 0.000 0.001 0.000 __init__.py:1240(is_published) 8 0.001 0.000 0.128 0.016 wrapper.py:146(get_multi) 233 0.001 0.000 0.001 0.000 cgi.py:1031(escape)
  61. 61. DoubanService• thrift RPC 务• PasteScript实现 码 务• https://github.com/twitter/thrift_client Python 负载 failover• nagios munin 监
  62. 62. Dpark• 计• Modeled after Spark, but using Python• mesos实现资 调 dpark = DparkContext() rdd = dpark.textFile(filepath) def filter(line): return pattern in line for line in rdd.filter(filter).collect(): sys.stdout.write(line)
  63. 63. pypcap + dpkt • Warm up MySQL slaves • Analyze MySQL issue with real- time queries
  64. 64. DAE• Modeled after Google AppEngine, but for internal use only• virtualenv to manage dependencies• gunicorn + gevent• Best practice built-in• Developing...
  65. 65. 编 语 in
  66. 66. 编 语 in
  67. 67. 编 语 in
  68. 68. 编 语 in
  69. 69. 编 语 in
  70. 70. 编 语 in
  71. 71. 编 语 in
  72. 72. 编 语 in
  73. 73. Q &A
  74. 74. Thanks

×