Differences between revisions 11 and 12
Revision 11 as of 2004-08-22 19:01:24
Size: 2967
Editor: cpe-68-112-255-10
Comment: Added more references.
Revision 12 as of 2004-08-22 19:15:41
Size: 3438
Editor: cpe-68-112-255-10
Comment:
Deletions are marked like this. Additions are marked like this.
Line 9: Line 9:
 * Replace all old-style classes. [[#a 4]]
Line 11: Line 12:
 * Remove support for old-style classes--all classes will be new-style. [[#a 4]]
 * Remove {{{`x`}}} in favor of `repr(x)`. [[#a 1]]
 * Remove the `lambda` statement. [[#a 1]] [[#a 4]]
 * Remove support for string exceptions. [[#a 1]]
Line 16: Line 13:
 * Do something so you can catch multiple exceptions using 'except E1, E2, E3:'. Maybe use 'except E1, E2, E3 as err:' if you want the error variable? (added by GvR, suggested by Bram Cohen).  * Do something so you can catch multiple exceptions using `except E1, E2, E3:`. Perhaps use `except E1, E2, E3 as err:` if you want the error variable. (Added by GvR, suggested by Bram Cohen.)
Line 23: Line 20:
 * Remove {{{`x`}}}. [[#a 1]]
   Alternatively: use `repr(x)`.
   Reasoning: backticks are hard to read in many fonts and can be mangled by typesetting software.
 * Remove the `lambda` statement. [[#a 1]] [[#a 4]]
   Alternatively: use a local function.
   Reasoning: `lambda` supports only one statement.
 * Remove support for string exceptions. [[#a 1]]
   Alternatively: use a class.
Line 26: Line 32:
 * Remove `dict.iteritems()`, `dict.iterkeys()`, `dict.itervalues()`.  * Move `compile()`, `intern()` and `id()` to the `sys` module. [[#a 1]]
Line 28: Line 34:
 * Remove `apply()`. Use `f(*args, **kw)` instead. [[#a 1]]
 * Remove `xrange()`. Use `range()` instead. [[#a 1]] [[#a 4]]
 * Remove `map()` and `filter()`. Use list comprehensions instead. [[#a 1]] [[#a 4]]

 * Remove `dict.iteritems()`, `dict.iterkeys()`, and `dict.itervalues()`.
   Alternatively: use `dict.items()`, `dict.keys()`, and `dict.values()` respectively.
 * Remove `apply()`. [[#a 1]]
   Alternatively: use `f(*args, **kw)`.
 * Remove `xrange()`. [[#a 1]] [[#a 4]]
   Alternatively: use `range()`.
 * Remove `map()` and `filter()`. [[#a 1]] [[#a 4]]
   Alternatively: use list comprehensions.
Line 32: Line 44:
 * Remove `reduce()`. Use a loop instead. [[#a 1]]
 * Remove `callable()`. Catch the exception instead. [[#a 1]]
 * Remove `buffer()` in favor of a new `bytes` type. [[#a 1]] [[#a 2]]
 * Remove `raw_input()`. Use `sys.stdin.readline()` instead. [[#a 1]]
 * Remove `input()`. Use 'eval(sys.stdin.readline())` instead. [[#a 1]]
 * Remove `execfile()` and `reload()`. Use `exec()` instead. [[#a 1]]
 * Move `compile()`, `intern()` and `id()` to the `sys` module. [[#a 1]]
 * Remove `reduce()`. [[#a 1]]
   Alternatively: use a loop.
 * Remove `callable()`. [[#a 1]]
   Alternatively: catch the exception.
 * Remove `buffer()`. [[#a 1]] [[#a 2]]
   Alternatively: use new `bytes` type.
 * Remove `raw_input()`. [[#a 1]]
   Alternatively: use `sys.stdin.readline()`.
 * Remove `input()`. [[#a 1]]
   Alternatively: use `eval(sys.stdin.readline())`.
 * Remove `execfile()` and `reload()`. [[#a 1]]
   Alternatively: use `exec()`.
Line 42: Line 59:
 * Remove `string` and other deprecated modules. [[#c 3]] [[#a 4]]
 * Remove `sys.exc_type` as it is not type safe. Use `sys.exc_info` instead. [[#a 1]]
 * Remove `string` module. [[#c 4]]
   Alternatively: use string methods.
 * Remove other deprecated modules. [[#c 3]]
 * Remove `sys.exc_type`. [[#a 1]]
   Alternatively: use `sys.exc_info`.
   Reason: as it is not thread safe.

This page lists features that GvR has mentioned as goals for Python 3.0.

(Another list is at PythonThreeDotOh, but it incorporates items that GvR has never talked about.)

Core Language Changes

  • Remove distinction between int and long types. #a 4

  • Make all strings unicode, and have a separate bytes type. #a 2 #a 4

  • Replace all old-style classes. #a 4

  • Make the exec statement a function (again.) #a 1

  • Make the print statement a function. (write(x,y,z), writeln(x,y,z)) #a 1

  • Perhaps have optional declarations for static typing.
  • Do something so you can catch multiple exceptions using except E1, E2, E3:. Perhaps use except E1, E2, E3 as err: if you want the error variable. (Added by GvR, suggested by Bram Cohen.)

  • Add a with statement:

    with self:
        .foo = [1, 2, 3]
        .bar(4, .foo)
  • Remove `x`. #a 1

    • Alternatively: use repr(x). Reasoning: backticks are hard to read in many fonts and can be mangled by typesetting software.

  • Remove the lambda statement. #a 1 #a 4

    • Alternatively: use a local function.

      Reasoning: lambda supports only one statement.

  • Remove support for string exceptions. #a 1

    • Alternatively: use a class.

Built-In Changes

  • Have range(), zip(), dict.keys(), dict.items(), and dict.values() return iterators.

  • Move compile(), intern() and id() to the sys module. #a 1

  • Change max() and min() to consume iterators.

  • Remove dict.iteritems(), dict.iterkeys(), and dict.itervalues().

    • Alternatively: use dict.items(), dict.keys(), and dict.values() respectively.

  • Remove apply(). #a 1

    • Alternatively: use f(*args, **kw).

  • Remove xrange(). #a 1 #a 4

    • Alternatively: use range().

  • Remove map() and filter(). #a 1 #a 4

    • Alternatively: use list comprehensions.
  • Remove coerce() as it is obsolete. #a 1

  • Remove reduce(). #a 1

    • Alternatively: use a loop.
  • Remove callable(). #a 1

    • Alternatively: catch the exception.
  • Remove buffer(). #a 1 #a 2

    • Alternatively: use new bytes type.

  • Remove raw_input(). #a 1

    • Alternatively: use sys.stdin.readline().

  • Remove input(). #a 1

    • Alternatively: use eval(sys.stdin.readline()).

  • Remove execfile() and reload(). #a 1

    • Alternatively: use exec().

Standard Library Changes

  • Remove string module. #c 4

    • Alternatively: use string methods.
  • Remove other deprecated modules. #c 3

  • Remove sys.exc_type. #a 1

    • Alternatively: use sys.exc_info. Reason: as it is not thread safe.

Unresolved Issues

  • L += x and L.extend(x) are equivalent.

  • Can the order of parameter of the insert method be changed so the the index parameter is optional and list.append can be removed?

  • What is the status of the <> operator?

References

Python3.0 (last edited 2011-04-08 16:42:51 by ip-109-90-196-137)

Unable to edit the page? See the FrontPage for instructions.