Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revise builtin class int library manual entry #46832

Closed
terryjreedy opened this issue Apr 8, 2008 · 2 comments
Closed

Revise builtin class int library manual entry #46832

terryjreedy opened this issue Apr 8, 2008 · 2 comments
Assignees
Labels
docs Documentation in the Doc dir

Comments

@terryjreedy
Copy link
Member

BPO 2580
Nosy @birkenfeld, @terryjreedy

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = 'https://github.com/birkenfeld'
closed_at = <Date 2008-04-09.18:45:24.310>
created_at = <Date 2008-04-08.02:26:14.462>
labels = ['docs']
title = 'Revise builtin class int library manual entry'
updated_at = <Date 2008-04-09.18:45:24.308>
user = 'https://github.com/terryjreedy'

bugs.python.org fields:

activity = <Date 2008-04-09.18:45:24.308>
actor = 'georg.brandl'
assignee = 'georg.brandl'
closed = True
closed_date = <Date 2008-04-09.18:45:24.310>
closer = 'georg.brandl'
components = ['Documentation']
creation = <Date 2008-04-08.02:26:14.462>
creator = 'terry.reedy'
dependencies = []
files = []
hgrepos = []
issue_num = 2580
keywords = []
message_count = 2.0
messages = ['65137', '65252']
nosy_count = 2.0
nosy_names = ['georg.brandl', 'terry.reedy']
pr_nums = []
priority = 'normal'
resolution = 'accepted'
stage = None
status = 'closed'
superseder = None
type = None
url = 'https://bugs.python.org/issue2580'
versions = ['Python 3.0']

@terryjreedy
Copy link
Member Author

Based on c.l.p discussion with Mark Dickinson, who supplied details and
corrections, we propose the following for the int() entry at
http://docs.python.org/dev/3.0/library/functions.html#int

int([number | string[, radix]])
Convert a number or string to an integer.  If no arguments are given,
return 0.  If a number is given, return number.__int__().  Conversion of
floating point numbers to integers truncates towards zero.  A string
must be a base-radix integer literal optionally preceded by '+' or '-'
(with no  space in between) and optionally surrounded by whitespace.  A
base-n literal consists of the digits 0 to n-1, with 'a' to 'z' (or 'A'
to 'Z')having values 10 to 35.  The default radix is 10. The allowed
values are 0 and 2-36.  Base-2, -8, and -16 literals can  be optionally
prefixed with 0b/0B, 0o/0O, or 0x/0X, as with integer literals in code.
 Radix 0 means to interpret exactly as a code literal, so that the
actual radix is 2, 8, 10, or 16, and so that int('010',0) is not legal,
while int('010') is.

The revised signature makes it clear from the start that *radix* can
only follow *string*, so no sentence to that effect is needed in the
text. The other changes are to discuss the signature in order and to
add details. We believe the above accurately reflects the
intended/actual behavior once the no-space-after-sign patch is applied.
(I don't know if that made it into .0a4).

Some of this might apply to the 2.6 docs, except that the no-space patch
will apparently not be backported. I believe the acceptable strings are
a bit different also, at least for octals, but I am not sure.

@terryjreedy terryjreedy added the docs Documentation in the Doc dir label Apr 8, 2008
@birkenfeld
Copy link
Member

Committed as r62253. Thanks!

@ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Documentation in the Doc dir
Projects
None yet
Development

No branches or pull requests

2 participants