Python 2.5 发布,支持Conditional Expressions

曾经笔记过用 and 和 or 来实现 Conditional Expressions。在刚发布的Python 2.5版已经明确的实现了这个功能

可以这样用了:
x = true_value if condition else false_value

当然,这只是Python 2.5 众多新特性中不起眼的一个吧。

No comments yet. Be the first.

Leave a reply

Additional comments powered by BackType

Random posts

  • 结构式图片生成服务, DayLight SMI2GIF
  • Lucene for Information Retrieval kicked off
  • Python 2.5 发布,支持Conditional Expressions
  • Fwd: Spy printers
  • 从google earth上看龙泽站的黑车