bk99.de entertain the web since 1997

Python 3.0 deliberately breaks with the past

Summary

The Python Software Foundation releases Python 3.0 and cleans up the language through deliberately incompatible changes. Python 3.0 was released on 3 December 2008. The release bore the code name Python 3000.

Ideas

  • print becomes a regular function.
  • Text and binary data get clearly separate types.
  • Integer division returns a floating-point result by default.
  • Iterators replace many lists that were previously built in full.
  • Exceptions and classes follow a unified syntax.
  • An automatic tool supports source code migration.

Insights

  • Long-term simplification can justify a controlled break in compatibility.
  • Migration tools reduce costs but do not replace complete tests.
  • Clear data types prevent entire classes of silent encoding bugs.
  • Parallel major versions prolong the transition for large ecosystems.

Facts

  • Python 2 and Python 3 were not fully source compatible.
  • The 2to3 tool automated many syntactic adjustments.

Recommendations

  • Migrate tests first and automate repeatable conversions.
  • Explicitly separate text, bytes and file encodings.
  • Check library support before switching production applications.

References

Read the original article

Search the Web Archive