Differences between revisions 1 and 3 (spanning 2 versions)
Revision 1 as of 2005-09-06 03:57:19
Size: 197
Editor: ZoomQuiet
Comment: Python 罕见问题集
Revision 3 as of 2005-09-06 04:05:22
Size: 2313
Editor: ZoomQuiet
Comment:
Deletions are marked like this. Additions are marked like this.
Line 7: Line 7:
Line 10: Line 9:
'''[http://www.norvig.com/python-iaq.html Infrequently Answered Questions]''' -- norvig.com
  * by [mailto:[email protected] Peter Norvig]
  * 收集Python 极精细的特性问题!值得学习!
----
 1. [wiki:self/PyIAQ/Q1 Q: What is an Infrequently Answered Question?]
 1. [wiki:self/PyIAQ/Q2 Q: The code in a finally clause will never fail to execute, right?]
 1. [wiki:self/PyIAQ/Q3 Q: Polymorphism is great; I can sort a list of elements of any type, right?]
 1. [wiki:self/PyIAQ/Q4 Q: Can I do ++x and x++ in Python?]
 1. [wiki:self/PyIAQ/Q5 Q: Can I use C++'s syntax for ostreams: cout << x << y ... ?]
 1. [wiki:self/PyIAQ/Q6 Q: What if I like C++'s printf?]
 1. [wiki:self/PyIAQ/Q7 Q: Is there a better syntax for dictionary literals? All my keys are identifiers]
 1. [wiki:self/PyIAQ/Q8 Q: Is there a similar shortcut for objects?]
 1. [wiki:self/PyIAQ/Q9 Q: That's great for creating objects; How about for updating?]
 1. [wiki:self/PyIAQ/Q10 Q: Can I have a dict with a default value of 0 or [ ] or something?]
 1. [wiki:self/PyIAQ/Q11 Q: Hey, can you write code to transpose a matrix in 0.007KB or less?]
 1. [wiki:self/PyIAQ/Q12 Q: The f(*m) trick is cool. Does the same syntax work with method calls, like x.f(*y)?]
 1. [wiki:self/PyIAQ/Q13 Q: Can you implement abstract classes in Python in 0 lines of code? Or 4?]
 1. [wiki:self/PyIAQ/Q14 Q: How do I do Enumerated Types (enums) in Python?]
 1. [wiki:self/PyIAQ/Q15 Q: Why is there no ``Set'' data type in Python?]
 1. [wiki:self/PyIAQ/Q16 Q: Should I, could I use a Boolean type?]
 1. [wiki:self/PyIAQ/Q17 Q: Can I do the equivalent of (test ? result : alternative) in Python?]
 1. [wiki:self/PyIAQ/Q18 Q: What other major types are missing from Python?]
 1. [wiki:self/PyIAQ/Q19 Q: How do I do the Singleton Pattern in Python?]
 1. [wiki:self/PyIAQ/Q20 Q: Is no "news" good news?]
 1. [wiki:self/PyIAQ/Q21 Q: Can I have a history mechanism like in the shell?]
 1. [wiki:self/PyIAQ/Q22 Q: How do I time the execution of my functions?]
 1. [wiki:self/PyIAQ/Q23 Q: What does your .python startup file look like?]

-----

Python 罕见问题集 ::-- ZoomQuiet [DateTime(2005-09-06T03:57:19Z)] TableOfContents [http://www.norvig.com/python-iaq.html Infrequently Answered Questions] -- norvig.com


  1. [wiki:self/PyIAQ/Q1 Q: What is an Infrequently Answered Question?]
  2. [wiki:self/PyIAQ/Q2 Q: The code in a finally clause will never fail to execute, right?]
  3. [wiki:self/PyIAQ/Q3 Q: Polymorphism is great; I can sort a list of elements of any type, right?]
  4. [wiki:self/PyIAQ/Q4 Q: Can I do ++x and x++ in Python?]
  5. [wiki:self/PyIAQ/Q5 Q: Can I use C++'s syntax for ostreams: cout << x << y ... ?]

  6. [wiki:self/PyIAQ/Q6 Q: What if I like C++'s printf?]
  7. [wiki:self/PyIAQ/Q7 Q: Is there a better syntax for dictionary literals? All my keys are identifiers]
  8. [wiki:self/PyIAQ/Q8 Q: Is there a similar shortcut for objects?]
  9. [wiki:self/PyIAQ/Q9 Q: That's great for creating objects; How about for updating?]
  10. [wiki:self/PyIAQ/Q10 Q: Can I have a dict with a default value of 0 or [ ] or something?]
  11. [wiki:self/PyIAQ/Q11 Q: Hey, can you write code to transpose a matrix in 0.007KB or less?]
  12. [wiki:self/PyIAQ/Q12 Q: The f(*m) trick is cool. Does the same syntax work with method calls, like x.f(*y)?]
  13. [wiki:self/PyIAQ/Q13 Q: Can you implement abstract classes in Python in 0 lines of code? Or 4?]
  14. [wiki:self/PyIAQ/Q14 Q: How do I do Enumerated Types (enums) in Python?]
  15. [wiki:self/PyIAQ/Q15 Q: Why is there no Set data type in Python?]

  16. [wiki:self/PyIAQ/Q16 Q: Should I, could I use a Boolean type?]
  17. [wiki:self/PyIAQ/Q17 Q: Can I do the equivalent of (test ? result : alternative) in Python?]
  18. [wiki:self/PyIAQ/Q18 Q: What other major types are missing from Python?]
  19. [wiki:self/PyIAQ/Q19 Q: How do I do the Singleton Pattern in Python?]
  20. [wiki:self/PyIAQ/Q20 Q: Is no "news" good news?]
  21. [wiki:self/PyIAQ/Q21 Q: Can I have a history mechanism like in the shell?]
  22. [wiki:self/PyIAQ/Q22 Q: How do I time the execution of my functions?]
  23. [wiki:self/PyIAQ/Q23 Q: What does your .python startup file look like?]


PyIAQ (last edited 2009-12-25 07:14:28 by localhost)