Differences between revisions 3 and 11 (spanning 8 versions)
Revision 3 as of 2004-08-17 17:32:49
Size: 1283
Comment: Add link to other 3.0 page
Revision 11 as of 2004-08-22 19:01:24
Size: 2967
Editor: cpe-68-112-255-10
Comment: Added more references.
Deletions are marked like this. Additions are marked like this.
Line 5: Line 5:
 * Reduce feature duplication:
   * string module vs. string methods
   * xrange() vs range()
   * int vs. long
   * 8 bit vs. Unicode strings
   * map/filter/reduce vs. list comprehensions
   * lambda vs. def
 * Library reorganization
 * Return iterators instead of lists
   * d.keys(), .values(), .items()
   * range(), zip(), map(), filter()
 * Consume iterators
   * min(), max()
 * Optional static typing?
 * Support only new-style classes; classic classes will be gone.
 * Remove string exceptions, `x` for repr(x), sys.exc_type, coerce(), other deprecated stuff
 * print as a function -- write(x,y,z), writeln(x,y,z)
== Core Language Changes ==
Line 23: Line 7:
See the "Python Regrets" talk and other recent presentations by Guido.  * Remove distinction between `int` and `long` types. [[#a 4]]
 * Make all strings unicode, and have a separate bytes type. [[#a 2]] [[#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]]
 * 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]]
 * Perhaps have optional declarations for static typing.
 * 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).
 * Add a `with` statement: {{{
with self:
    .foo = [1, 2, 3]
    .bar(4, .foo)
}}}
Line 25: Line 23:
== Rearrangements == == Built-In Changes ==
Line 27: Line 25:
intern(), id(): put in sys  * Have `range()`, `zip()`, `dict.keys()`, `dict.items()`, and `dict.values()` return iterators.
 * Remove `dict.iteritems()`, `dict.iterkeys()`, `dict.itervalues()`.
 * Change `max()` and `min()` to consume iterators.
 * 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 `coerce()` as it is obsolete. [[#a 1]]
 * 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]]
Line 29: Line 40:
xrange(): make range() return an iterator == Standard Library Changes ==
Line 31: Line 42:
buffer(): must die (use bytes, PEP 296)  * 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]]
Line 33: Line 45:
raw_input(): use sys.stdin.readline() == Unresolved Issues ==
Line 35: Line 47:
input(): use eval(sys.stdin.readline())  * `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?
Line 37: Line 51:
callable(): just call it, already == References ==
Line 39: Line 53:
execfile(), reload(): use exec()

compile(): put in sys

exec as a statement is not worth it -- make it a function


 * [[Anchor(a)]] [1] Python Regrets: http://www.python.org/doc/essays/ppt/regrets/PythonRegrets.pdf
 * [[Anchor(b)]] [2] PEP 296 -- Adding a bytes Object Type: http://python.org/peps/pep-0296.html
 * [[Anchor(c)]] [3] PEP 4 -- Deprecation of Standard Modules: http://python.org/peps/pep-0004.html
 * [[Anchor(d)]] [4] PyCon 2003 State of the Union Address: http://www.python.org/doc/essays/ppt/pycon2003/pycon2003.ppt

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

  • 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

  • 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

  • Perhaps have optional declarations for static typing.
  • 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).
  • Add a with statement:

    with self:
        .foo = [1, 2, 3]
        .bar(4, .foo)

Built-In Changes

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

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

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

  • 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 coerce() as it is obsolete. #a 1

  • 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

Standard Library Changes

  • 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

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.