上一页 1 ··· 328 329 330 331 332 333 334 335 336 ··· 477 下一页
摘要: Default arguments are a helpful feature, but there is one situation where they can be surprisingly unhelpful. Using a mutable type (like a list or dic 阅读全文
posted @ 2017-11-27 21:53 Zhentiw 阅读(203) 评论(0) 推荐(0)
摘要: Python provides another useful built-in type: tuples. Tuples are used to store related pieces of information. Consider this example involving latitude 阅读全文
posted @ 2017-11-27 21:48 Zhentiw 阅读(487) 评论(0) 推荐(0)
摘要: What a Proxy does is handle communication for an Object. To create a proxy object, we use the Proxy constructor - new Proxy();. The proxy constructor 阅读全文
posted @ 2017-11-26 16:08 Zhentiw 阅读(258) 评论(0) 推荐(0)
摘要: The iterator protocol is used to define a standard way that an object produces a sequence of values. What that really means is you now have a process 阅读全文
posted @ 2017-11-21 15:20 Zhentiw 阅读(244) 评论(0) 推荐(0)
摘要: Write a function, remove_duplicates that takes a list as its argument and returns a new list containing the unique elements of the original list. The 阅读全文
posted @ 2017-11-21 14:52 Zhentiw 阅读(372) 评论(0) 推荐(0)
摘要: Let's introduce a new string method, join: Also note thatjoin will trigger an error if we try to join anything other than strings. For example: 阅读全文
posted @ 2017-11-21 14:45 Zhentiw 阅读(536) 评论(0) 推荐(0)
摘要: In addition to accessing individual elements from a list we can use Python's slicing notation to access a subsequence of a list. Consider this list of 阅读全文
posted @ 2017-11-21 14:02 Zhentiw 阅读(379) 评论(0) 推荐(0)
摘要: A symbol is a unique and immutable data type that is often used to identify object properties. To create a symbol, you write Symbol() with an optional 阅读全文
posted @ 2017-11-17 14:38 Zhentiw 阅读(237) 评论(0) 推荐(0)
摘要: One particularly useful string method is format. The format method is used to construct strings by inserting values into template strings. Consider th 阅读全文
posted @ 2017-11-13 20:13 Zhentiw 阅读(273) 评论(0) 推荐(0)
摘要: For example we have an object: We shallow copy it: Verify that shallowCopy is not todo: Change text prop of shallowCopy to somethingelse: But if we wa 阅读全文
posted @ 2017-11-13 17:59 Zhentiw 阅读(305) 评论(0) 推荐(0)
上一页 1 ··· 328 329 330 331 332 333 334 335 336 ··· 477 下一页