Python 罕见问题集 ::-- ZoomQuiet [2005-09-06 03:57:19]

[WWW] Infrequently Answered Questions -- norvig.com


  1. [self]Q: What is an Infrequently Answered Question?

  2. [self]Q: The code in a finally clause will never fail to execute, right?

  3. [self]Q: Polymorphism is great; I can sort a list of elements of any type, right?

  4. [self]Q: Can I do ++x and x++ in Python?

  5. [self]Q: Can I use C++'s syntax for ostreams: cout << x << y ... ?

  6. [self]Q: What if I like C++'s printf?

  7. [self]Q: Is there a better syntax for dictionary literals? All my keys are identifiers

  8. [self]Q: Is there a similar shortcut for objects?

  9. [self]Q: 创建对象很爽,但是如何更新? 100%-- ZoomQuiet

    • That's great for creating objects; How about for updating?

  10. [self]Q: Can I have a dict with a default value of 0 or [ or something?]

  11. [self]Q: Hey, can you write code to transpose a matrix in 0.007KB or less?

  12. [self]Q: The f(*m) trick is cool. Does the same syntax work with method calls, like x.f(*y)?

  13. [self]Q: Can you implement abstract classes in Python in 0 lines of code? Or 4?

  14. [self]Q: How do I do Enumerated Types (enums) in Python?

  15. [self]Q: Why is there no ``Set'' data type in Python?

  16. [self]Q: Should I, could I use a Boolean type?

  17. [self]Q: Can I do the equivalent of (test ? result : alternative) in Python?

  18. [self]Q: What other major types are missing from Python?

  19. [self]Q: How do I do the Singleton Pattern in Python?

  20. [self]Q: Is no "news" good news?

  21. [self]Q: Can I have a history mechanism like in the shell?

  22. [self]Q: How do I time the execution of my functions?

  23. [self]Q: What does your .python startup file look like?


last edited 2005-09-09 13:44:49 by holin