Python 罕见问题集 ::-- ZoomQuiet [2005-09-06 03:57:19]
Infrequently Answered Questions -- norvig.comby Peter Norvig
收集Python 极精细的特性问题!值得学习!
大家来共同翻译吧!创建页面时使用 PyIAQ模板 是也乎…………
Q: The code in a finally clause will never fail to execute, right?
Q: Polymorphism is great; I can sort a list of elements of any type, right?
Q: Can I use C++'s syntax for ostreams: cout << x << y ... ?
Q: Is there a better syntax for dictionary literals? All my keys are identifiers
Q: 创建对象很爽,但是如何更新? 100%-- ZoomQuiet
That's great for creating objects; How about for updating?
Q: Can I have a dict with a default value of 0 or [ or something?]
Q: Hey, can you write code to transpose a matrix in 0.007KB or less?
Q: The f(*m) trick is cool. Does the same syntax work with method calls, like x.f(*y)?
Q: Can you implement abstract classes in Python in 0 lines of code? Or 4?
Q: Can I do the equivalent of (test ? result : alternative) in Python?