Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Python 3.0: Where we break all your code

Python 3.0: Where we break all your code

Abhinav Sarkar

September 13, 2008
Tweet

More Decks by Abhinav Sarkar

Other Decks in Programming

Transcript

  1. Python 3.0 where we break all your code Abhinav Sarkar

    abhinav@abhinavsarkar.net abhinav.sarkar@gmail.com BARCAMP BANGALORE 7
  2. 3.0

  3. !!

  4. def fun(arg1, arg2, *, flag=False): pass >>> fun(1,2,3) Traceback (most

    recent call last): File “<stdin>”, line 1, in <module> TypeError: fun() takes exactly 2 positional arguments (3 given)
  5. documentation def doEvil(plan: “a plan”) -> “evil results”: .... types

    def foo(a: float, b: int, c:list) -> dict: .... more complex def processFiles(*files: “one or more of filenames”, delete: “delete when done” = False) -> “a boolean”: ....
  6. take 2.5 code get working on 2.6 turn -3 flag

    while True: run through 2to3 run unit tests under 3.0 fix 2.x code
  7. python 2.6 interim release -3 flag: turns on warnings from

    __future__ from future_builtins import enables some backports