2013年5月10日 星期五

python: __feature__ modules



__future__ is a real module, and serves three purposes:
  • To avoid confusing existing tools that analyze import statements and expect to find the modules they’re importing.
  • To ensure that future statements run under releases prior to 2.1 at least yield runtime exceptions (the import of __future__ will fail, because there was no module of that name prior to 2.1).
  • To document when incompatible changes were introduced, and when they will be — or were — made mandatory. This is a form of executable documentation, and can be inspected programmatically via importing __future__ and examining its contents.

Reference:


沒有留言:

張貼留言