8000 Merged revisions 55007-55179 via svnmerge from · python/cpython@805365e · GitHub
[go: up one dir, main page]

Skip to content

Commit 805365e

Browse files
committed
Merged revisions 55007-55179 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/p3yk ........ r55077 | guido.van.rossum | 2007-05-02 11:54:37 -0700 (Wed, 02 May 2007) | 2 lines Use the new print syntax, at least. ........ r55142 | fred.drake | 2007-05-04 21:27:30 -0700 (Fri, 04 May 2007) | 1 line remove old cruftiness ........ r55143 | fred.drake | 2007-05-04 21:52:16 -0700 (Fri, 04 May 2007) | 1 line make this work with the new Python ........ r55162 | neal.norwitz | 2007-05-06 22:29:18 -0700 (Sun, 06 May 2007) | 1 line Get asdl code gen working with Python 2.3. Should continue to work with 3.0 ........ r55164 | neal.norwitz | 2007-05-07 00:00:38 -0700 (Mon, 07 May 2007) | 1 line Verify checkins to p3yk (sic) branch go to 3000 list. ........ r55166 | neal.norwitz | 2007-05-07 00:12:35 -0700 (Mon, 07 May 2007) | 1 line Fix this test so it runs again by importing warnings_test properly. ........ r55167 | neal.norwitz | 2007-05-07 01:03:22 -0700 (Mon, 07 May 2007) | 8 lines So long xrange. range() now supports values that are outside -sys.maxint to sys.maxint. floats raise a TypeError. This has been sitting for a long time. It probably has some problems and needs cleanup. Objects/rangeobject.c now uses 4-space indents since it is almost completely new. ........ r55171 | guido.van.rossum | 2007-05-07 10:21:26 -0700 (Mon, 07 May 2007) | 4 lines Fix two tests that were previously depending on significant spaces at the end of a line (and before that on Python 2.x print behavior that has no exact equivalent in 3.0). ........
1 parent 598d98a commit 805365e
  • Misc
  • Objects
  • Parser
  • Python
  • Tools
  • Some content is hidden

    Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

    150 files changed

    +1424
    -1332
    lines changed

    Demo/tix/grid.py

    Lines changed: 2 additions & 2 deletions
    Original file line numberDiff line numberDiff line change
    @@ -18,8 +18,8 @@ def editnotify(self, x, y):
    1818
    g = MyGrid(r, name="a_grid",
    1919
    selectunit="cell")
    2020
    g.pack(fill=tk.BOTH)
    21-
    for x in xrange(5):
    22-
    for y in xrange(5):
    21+
    for x in range(5):
    22+
    for y in range(5):
    2323
    g.set(x,y,text=str((x,y)))
    2424

    2525
    c = tk.Button(r, text="Close", command=r.destroy)

    Doc/lib/libdbhash.tex

    Lines changed: 1 addition & 1 deletion
    Original file line numberDiff line numberDiff line change
    @@ -72,7 +72,7 @@ \subsection{Database Objects \label{dbhash-objects}}
    7272

    7373
    \begin{verbatim}
    7474
    print db.first()
    75-
    for i in xrange(1, len(db)): D30D
    75+
    for i in range(1, len(db)):
    7676
    print db.next()
    7777
    \end{verbatim}
    7878
    \end{methoddesc}

    Doc/lib/libfuncs.tex

    Lines changed: 8 additions & 26 deletions
    Original file line numberDiff line numberDiff line change
    @@ -868,7 +868,7 @@ \section{Built-in Functions \label{built-in-funcs}}
    868868
    \end{funcdesc}
    869869

    870870
    \begin{funcdesc}{range}{\optional{start,} stop\optional{, step}}
    871-
    This is a versatile function to create lists containing arithmetic
    871+
    This is a versatile function to create sequences containing arithmetic
    872872
    progressions. It is most often used in \keyword{for} loops. The
    873873
    arguments must be plain integers. If the \var{step} argument is
    874874
    omitted, it defaults to \code{1}. If the \var{start} argument is
    @@ -882,19 +882,19 @@ \section{Built-in Functions \label{built-in-funcs}}
    882882
    \exception{ValueError} is raised). Example:
    883883

    884884
    \begin{verbatim}
    885-
    >>> range(10)
    885+
    >>> list(range(10))
    886886
    [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
    887-
    >>> range(1, 11)
    887+
    >>> list(range(1, 11))
    888888
    [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
    889-
    >>> range(0, 30, 5)
    889+
    >>> list(range(0, 30, 5))
    890890
    [0, 5, 10, 15, 20, 25]
    891-
    >>> range(0, 10, 3)
    891+
    >>> list(range(0, 10, 3))
    892892
    [0, 3, 6, 9]
    893-
    >>> range(0, -10, -1)
    893+
    >>> list(range(0, -10, -1))
    894894
    [0, -1, -2, -3, -4, -5, -6, -7, -8, -9]
    895-
    >>> range(0)
    895+
    >>> list(range(0))
    896896
    []
    897-
    >>> range(1, 0)
    897+
    >>> list(range(1, 0))
    898898
    []
    899899
    \end{verbatim}
    900900
    \end{funcdesc}
    @@ -1230,24 +1230,6 @@ \section{Built-in Functions \label{built-in-funcs}}
    12301230
    other scopes (such as modules) can be. This may change.}
    12311231
    \end{funcdesc}
    12321232

    1233-
    \begin{funcdesc}{xrange}{\optional{start,} stop\optional{, step}}
    1234-
    This function is very similar to \function{range()}, but returns an
    1235-
    ``xrange object'' instead of a list. This is an opaque sequence
    1236-
    type which yields the same values as the corresponding list, without
    1237-
    actually storing them all simultaneously. The advantage of
    1238-
    \function{xrange()} over \function{range()} is minimal (since
    1239-
    \function{xrange()} still has to create the values when asked for
    1240-
    them) except when a very large range is used on a memory-starved
    1241-
    machine or when all of the range's elements are never used (such as
    1242-
    when the loop is usually terminated with \keyword{break}).
    1243-
    1244-
    \note{\function{xrange()} is intended to be simple and fast.
    1245-
    Implementations may impose restrictions to achieve this.
    1246-
    The C implementation of Python restricts all arguments to
    1247-
    native C longs ("short" Python integers), and also requires
    1248-
    that the number of elements fit in a native C long.}
    1249-
    \end{funcdesc}
    1250-
    12511233
    \begin{funcdesc}{zip}{\optional{iterable, \moreargs}}
    12521234
    This function returns a list of tuples, where the \var{i}-th tuple contains
    12531235
    the \var{i}-th element from each of the argument sequences or iterables.

    Doc/lib/libitertools.tex

    Lines changed: 4 additions & 4 deletions
    Original file line numberDiff line numberDiff line change
    @@ -161,7 +161,7 @@ \subsection{Itertool functions \label{itertools-functions}}
    161161
    key = lambda x: x
    162162
    self.keyfunc = key
    163163
    self.it = iter(iterable)
    164-
    self.tgtkey = self.currkey = self.currvalue = xrange(0)
    164+
    self.tgtkey = self.currkey = self.currvalue = []
    165165
    def __iter__(self):
    166166
    return self
    167167
    def __next__(self):
    @@ -252,7 +252,7 @@ \subsection{Itertool functions \label{itertools-functions}}
    252252
    \begin{verbatim}
    253253
    def islice(iterable, *args):
    254254
    s = slice(*args)
    255-
    it = iter(xrange(s.start or 0, s.stop or sys.maxint, s.step or 1))
    255+
    it = iter(range(s.start or 0, s.stop or sys.maxint, s.step or 1))
    256256
    nexti = next(it)
    257257
    for i, element in enumerate(iterable):
    258258
    if i == nexti:
    @@ -342,7 +342,7 @@ \subsection{Itertool functions \label{itertools-functions}}
    342342
    while True:
    343343
    yield object
    344344
    else:
    345-
    for i in xrange(times):
    345+
    for i in range(times):
    346346
    yield object
    347347
    \end{verbatim}
    348348
    \end{funcdesc}
    @@ -425,7 +425,7 @@ \subsection{Examples \label{itertools-example}}
    425425
    Check 1202 is for $823.14
    426426
    427427
    >>> import operator
    428-
    >>> for cube in imap(operator.pow, xrange(1,5), repeat(3)):
    428+
    >>> for cube in imap(operator.pow, range(1,5), repeat(3)):
    429429
    ... print cube
    430430
    ...
    431431
    1

    Doc/lib/librandom.tex

    Lines changed: 2 additions & 2 deletions
    Original file line numberDiff line numberDiff line change
    @@ -163,9 +163,9 @@ \section{\module{random} ---
    163163
    population contains repeats, then each occurrence is a possible
    164164
    selection in the sample.
    165165

    166-
    To choose a sample from a range of integers, use an \function{xrange()}
    166+
    To choose a sample from a range of integers, use an \function{range()}
    167167
    object as an argument. This is especially fast and space efficient for
    168-
    sampling from a large population: \code{sample(xrange(10000000), 60)}.
    168+
    sampling from a large population: \code{sample(range(10000000), 60)}.
    169169
    \end{funcdesc}
    170170

    171171

    Doc/lib/libstdtypes.tex

    Lines changed: 9 additions & 9 deletions
    Original file line numberDiff line numberDiff line change
    @@ -403,11 +403,11 @@ \section{Iterator Types \label{typeiter}}
    403403

    404404
    \section{Sequence Types ---
    405405
    \class{str}, \class{unicode}, \class{list},
    406-
    \class{tuple}, \class{buffer}, \class{xrange}
    406+
    \class{tuple}, \class{buffer}, \class{range}
    407407
    \label{typesseq}}
    408408

    409409
    There are six sequence types: strings, Unicode strings, lists,
    410-
    tuples, buffers, and xrange objects.
    410+
    tuples, buffers, and range objects.
    411411

    412412
    String literals are written in single or double quotes:
    413413
    \code{'xyzzy'}, \code{"frobozz"}. See chapter 2 of the
    @@ -433,11 +433,11 @@ \section{Sequence Types ---
    433433
    \obindex{buffer}
    434434

    435435
    Xrange objects are similar to buffers in that there is no specific
    436-
    syntax to create them, but they are created using the \function{xrange()}
    437-
    function.\bifuncindex{xrange} They don't support slicing,
    436+
    syntax to create them, but they are created using the \function{range()}
    437+
    function.\bifuncindex{range} They don't support slicing,
    438438
    concatenation or repetition, and using \code{in}, \code{not in},
    439439
    \function{min()} or \function{max()} on them is inefficient.
    440-
    \obindex{xrange}
    440+
    \obindex{range}
    441441

    442442
    Most sequence types support the following operations. The \samp{in} and
    443443
    \samp{not in} operations have the same priorities as the comparison
    @@ -1069,11 +1069,11 @@ \subsection{String Formatting Operations \label{typesseq-strings}}
    10691069
    \refmodule{re}.\refstmodindex{re}
    10701070

    10711071

    1072-
    \subsection{XRange Type \label{typesseq-xrange}}
    1072+
    \subsection{XRange Type \label{typesseq-range}}
    10731073

    1074-
    The \class{xrange}\obindex{xrange} type is an immutable sequence which
    1075-
    is commonly used for looping. The advantage of the \class{xrange}
    1076-
    type is that an \class{xrange} object will always take the same amount
    1074+
    The \class{range}\obindex{range} type is an immutable sequence which
    1075+
    is commonly used for looping. The advantage of the \class{range}
    1076+
    type is that an \class{range} object will always take the same amount
    10771077
    of memory, no matter the size of the range it represents. There are
    10781078
    no consistent performance advantages.
    10791079

    Doc/lib/libtimeit.tex

    Lines changed: 1 addition & 1 deletion
    Original file line numberDiff line numberDiff line change
    @@ -98,7 +98,7 @@ \section{\module{timeit} ---
    9898
    measured. If so, GC can be re-enabled as the first statement in the
    9999
    \var{setup} string. For example:
    100100
    \begin{verbatim}
    101-
    timeit.Timer('for i in xrange(10): oct(i)', 'gc.enable()').timeit()
    101+
    timeit.Timer('for i in range(10): oct(i)', 'gc.enable()').timeit()
    102102
    \end{verbatim}
    103103
    \end{notice}
    104104
    \end{methoddesc}

    Doc/lib/libtypes.tex

    Lines changed: 2 additions & 2 deletions
    Original file line numberDiff line numberDiff line change
    @@ -147,9 +147,9 @@ \section{\module{types} ---
    147147
    The type of open file objects such as \code{sys.stdout}.
    148148
    \end{datadesc}
    149149

    150-
    \begin{datadesc}{XRangeType}
    150+
    \begin{datadesc}{RangeType}
    151151
    The type of range objects returned by
    152-
    \function{xrange()}\bifuncindex{xrange}.
    152+
    \function{range()}\bifuncindex{range}.
    153153
    \end{datadesc}
    154154

    155155
    \begin{datadesc}{SliceType}

    Doc/tut/tut.tex

    Lines changed: 4 additions & 4 deletions
    Original file line numberDiff line numberDiff line change
    @@ -2260,7 +2260,7 @@ \section{Looping Techniques \label{loopidioms}}
    22602260
    function.
    22612261

    22622262
    \begin{verbatim}
    2263-
    >>> for i in reversed(xrange(1,10,2)):
    2263+
    >>> for i in reversed(range(1,10,2)):
    22642264
    ... print i
    22652265
    ...
    22662266
    9
    @@ -2700,12 +2700,12 @@ \section{The \function{dir()} Function \label{dir}}
    27002700
    'complex', 'copyright', 'credits', 'delattr', 'dict', 'dir', 'divmod',
    27012701
    'enumerate', 'eval', 'exec', 'execfile', 'exit', 'file', 'filter', 'float',
    27022702
    'frozenset', 'getattr', 'globals', 'hasattr', 'hash', 'help', 'hex',
    2703-
    'id', 'int', 'isinstance', 'issubclass', 'iter',
    2703+
    'id', 'input', 'int', 'isinstance', 'issubclass', 'iter',
    27042704
    'len', 'license', 'list', 'locals', 'long', 'map', 'max', 'min',
    27052705
    'object', 'oct', 'open', 'ord', 'pow', 'property', 'quit', 'range',
    27062706
    'reload', 'repr', 'reversed', 'round', 'set',
    27072707
    'setattr', 'slice', 'sorted', 'staticmethod', 'str', 'sum', 'super',
    2708-
    'tuple', 'type', 'unichr', 'unicode', 'vars', 'xrange', 'zip']
    2708+
    'tuple', 'type', 'unichr', 'unicode', 'vars', 'zip']
    27092709
    \end{verbatim}
    27102710

    27112711

    @@ -4762,7 +4762,7 @@ \section{Mathematics\label{mathematics}}
    47624762
    >>> import random
    47634763
    >>> random.choice(['apple', 'pear', 'banana'])
    47644764
    'apple'
    4765-
    >>> random.sample(xrange(100), 10) # sampling without replacement
    4765+
    >>> random.sample(range(100), 10) # sampling without replacement
    47664766
    [30, 83, 16, 4, 8, 81, 41, 50, 18, 33]
    47674767
    >>> random.random() # random float
    47684768
    0.17970987693706186

    Doc/whatsnew/Makefile

    Lines changed: 0 additions & 3 deletions
    This file was deleted.

    0 commit comments

    Comments
     (0)
    0