上一页 1 ··· 7 8 9 10 11 12 13 14 15 ··· 24 下一页
摘要: 1. Object Representations Every object-oriented language has at least one standard way of getting a string representation from any object. Python has 阅读全文
posted @ 2020-02-10 01:07 neozheng 阅读(173) 评论(0) 推荐(0) 编辑
摘要: 1. Varaibles Are Labels, Not Boxes. Python varaibles are like reference variables in Java, so it's better to think of them as labels attached to objec 阅读全文
posted @ 2020-02-08 02:41 neozheng 阅读(189) 评论(0) 推荐(0) 编辑
摘要: Function decorators let us "mark" functions in the source code to enhance their behavior in some way. This is powful stuff, but mastering it requires 阅读全文
posted @ 2020-02-03 01:02 neozheng 阅读(189) 评论(0) 推荐(0) 编辑
摘要: Although design patterns are language-independent, that does not mean every pattern applies to every language. If we assumed procedural languages, we 阅读全文
posted @ 2020-02-02 02:16 neozheng 阅读(168) 评论(0) 推荐(0) 编辑
摘要: The "First-Class object" in Python: Created at runtime Assigned to a variable or element in a data structure Pass as an augument to a function Return 阅读全文
posted @ 2020-01-31 01:16 neozheng 阅读(145) 评论(0) 推荐(0) 编辑
摘要: 1. Handling missing keys with setdefault import sys import re WORD_RE = re.compile('\w+') index = {} print(sys.argv) # Example 3-2 with open(sys.argv[ 阅读全文
posted @ 2020-01-12 00:52 neozheng 阅读(171) 评论(0) 推荐(0) 编辑
摘要: 1. Managing Ordered Sequences with bisect The bisect module offers two main functions bisect and insort that use the binary serach algorithm to quickl 阅读全文
posted @ 2020-01-05 01:16 neozheng 阅读(213) 评论(0) 推荐(0) 编辑
摘要: 1. Listcomps (List comprehensions) do everything the map and filter functions do. (map 函数和 filter函数能做的,列表生成式都可以做) 列表生成式和 map, filter 函数运行时间的比较示例: impo 阅读全文
posted @ 2020-01-01 13:24 neozheng 阅读(223) 评论(0) 推荐(0) 编辑
摘要: 列表推导式总共有两种形式: ① [x for x in data if condition] # 此处if主要起条件判断作用,data数据中只有满足if条件的才会被留下,最后统一生成为一个数据列表 ② [exp1 if condition else exp2 for x in data] # 此处i 阅读全文
posted @ 2019-12-31 22:59 neozheng 阅读(3593) 评论(1) 推荐(2) 编辑
摘要: Markdown 是一种轻量级标记语言,它允许人们使用易读、易写的纯文本格式编写文档。Markdown 语言需要经过编辑器的渲染才能呈现出各种优美的格式。 Markdown 的使用场景: 当你对文章的排版没什么特殊需求,且不想花太多时间在排版上时,就可以使用 Markdown。因为编辑器或平台会通过 阅读全文
posted @ 2019-12-28 13:36 neozheng 阅读(385) 评论(0) 推荐(0) 编辑
上一页 1 ··· 7 8 9 10 11 12 13 14 15 ··· 24 下一页