Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
4a7df9ab
Commit
4a7df9ab
authored
Oct 07, 2012
by
Chris Jerdonek
Browse files
Options
Browse Files
Download
Plain Diff
Issue #14783: Merge changes from 3.3.
parents
8836eefb
042fa653
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
25 additions
and
11 deletions
+25
-11
Doc/library/functions.rst
Doc/library/functions.rst
+2
-1
Misc/NEWS
Misc/NEWS
+3
-0
Objects/longobject.c
Objects/longobject.c
+13
-6
Objects/rangeobject.c
Objects/rangeobject.c
+3
-2
Objects/sliceobject.c
Objects/sliceobject.c
+2
-1
Objects/unicodeobject.c
Objects/unicodeobject.c
+2
-1
No files found.
Doc/library/functions.rst
View file @
4a7df9ab
...
...
@@ -1203,7 +1203,8 @@ are always available. They are listed here in alphabetical order.
.. _func-str:
.. function:: str([object[, encoding[, errors]]])
.. function:: str(object='')
str(object[, encoding[, errors]])
Return a string version of an object, using one of the following modes:
...
...
Misc/NEWS
View file @
4a7df9ab
...
...
@@ -10,6 +10,9 @@ What's New in Python 3.4.0 Alpha 1?
Core and Builtins
-----------------
- Issue #14783: Improve int() docstring and switch docstrings for str(),
range(), and slice() to use multi-line signatures.
- Upgrade Unicode data (UCD) to version 6.2.
- Issue #15379: Fix passing of non-BMP characters as integers for the charmap
...
...
Objects/longobject.c
View file @
4a7df9ab
...
...
@@ -4847,13 +4847,20 @@ static PyGetSetDef long_getset[] = {
};
PyDoc_STRVAR
(
long_doc
,
"int(x[, base]) -> integer
\n
\
"int(x=0) -> integer
\n
\
int(x, base=10) -> integer
\n
\
\n
\
Convert a string or number to an integer, if possible. A floating
\n
\
point argument will be truncated towards zero (this does not include a
\n
\
string representation of a floating point number!) When converting a
\n
\
string, use the optional base. It is an error to supply a base when
\n
\
converting a non-string."
);
Convert a number or string to an integer, or return 0 if no arguments
\n
\
are given. If x is a number, return x.__int__(). For floating point
\n
\
numbers, this truncates towards zero.
\n
\
\n
\
If x is not a number or if base is given, then x must be a string,
\n
\
bytes, or bytearray instance representing an integer literal in the
\n
\
given base. The literal can be preceded by '+' or '-' and be surrounded
\n
\
by whitespace. The base defaults to 10. Valid bases are 0 and 2-36.
\n
\
Base 0 means to interpret the base from the string as an integer literal.
\n
\
>>> int('0b100', base=0)
\n
\
4"
);
static
PyNumberMethods
long_as_number
=
{
(
binaryfunc
)
long_add
,
/*nb_add*/
...
...
Objects/rangeobject.c
View file @
4a7df9ab
...
...
@@ -136,7 +136,8 @@ range_new(PyTypeObject *type, PyObject *args, PyObject *kw)
}
PyDoc_STRVAR
(
range_doc
,
"range([start,] stop[, step]) -> range object
\n
\
"range(stop) -> range object
\n
\
range(start, stop[, step]) -> range object
\n
\
\n
\
Returns a virtual sequence of numbers from start to stop by step."
);
...
...
@@ -969,7 +970,7 @@ rangeiter_reduce(rangeiterobject *r)
{
PyObject
*
start
=
NULL
,
*
stop
=
NULL
,
*
step
=
NULL
;
PyObject
*
range
;
/* create a range object for pickling */
start
=
PyLong_FromLong
(
r
->
start
);
if
(
start
==
NULL
)
...
...
Objects/sliceobject.c
View file @
4a7df9ab
...
...
@@ -269,7 +269,8 @@ slice_new(PyTypeObject *type, PyObject *args, PyObject *kw)
}
PyDoc_STRVAR
(
slice_doc
,
"slice([start,] stop[, step])
\n
\
"slice(stop)
\n
\
slice(start, stop[, step])
\n
\
\n
\
Create a slice object. This is used for extended slicing (e.g. a[0:10:2])."
);
...
...
Objects/unicodeobject.c
View file @
4a7df9ab
...
...
@@ -14133,7 +14133,8 @@ onError:
}
PyDoc_STRVAR
(
unicode_doc
,
"str(object[, encoding[, errors]]) -> str
\n
\
"str(object='') -> str
\n
\
str(bytes_or_buffer[, encoding[, errors]]) -> str
\n
\
\n
\
Create a new string object from the given object. If encoding or
\n
\
errors is specified, then the object must expose a data buffer
\n
\
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment