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

range() description: rewording suggested #36242

Closed
cjwhrh mannequin opened this issue Mar 12, 2002 · 3 comments
Closed

range() description: rewording suggested #36242

cjwhrh mannequin opened this issue Mar 12, 2002 · 3 comments
Labels
docs Documentation in the Doc dir

Comments

@cjwhrh
Copy link
Mannequin

cjwhrh mannequin commented Mar 12, 2002

BPO 528748
Nosy @freddrake, @rhettinger

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 = None
closed_at = <Date 2002-06-17.15:30:32.000>
created_at = <Date 2002-03-12.00:49:53.000>
labels = ['docs']
title = 'range() description: rewording suggested'
updated_at = <Date 2002-06-17.15:30:32.000>
user = 'https://bugs.python.org/cjwhrh'

bugs.python.org fields:

activity = <Date 2002-06-17.15:30:32.000>
actor = 'fdrake'
assignee = 'none'
closed = True
closed_date = None
closer = None
components = ['Documentation']
creation = <Date 2002-03-12.00:49:53.000>
creator = 'cjwhrh'
dependencies = []
files = []
hgrepos = []
issue_num = 528748
keywords = []
message_count = 3.0
messages = ['9644', '9645', '9646']
nosy_count = 3.0
nosy_names = ['fdrake', 'rhettinger', 'cjwhrh']
pr_nums = []
priority = 'normal'
resolution = 'rejected'
stage = None
status = 'closed'
superseder = None
type = None
url = 'https://bugs.python.org/issue528748'
versions = []

@cjwhrh
Copy link
Mannequin Author

cjwhrh mannequin commented Mar 12, 2002

The help now has:
range([start,] stop[, step])
This is a versatile function to create lists containing arithmetic
progressions. It is most often used in for loops. The arguments
must be plain integers. If the step argument is omitted, it
defaults to 1. If the start argument is omitted, it defaults to
0. The full form returns a list of plain integers [start, start +
step, start + 2 * step, ...]. If step is positive, the last
element is the largest start + i * step less than stop; if step is
negative, the last element is the largest start + i * step greater
than stop. step must not be zero (or else ValueError is raised).

It might say:

     range([start= 0,] stop[, step= 1]) 
     This function creates a list containing an arithmetic progression.
     The arguments must be integers.   If only one argument is passed it 
     is the 'stop' value, if two values are passed then the first is the
     'start' value and the second the 'stop' value.
     The function returns a list of integers [start, start + step, start
     + 2 * step, ...]. The 'step' must not be zero; if 'step' is positive, 
     the last element is the largest; if  'step' is negative, the last
     element is the smallest.

Using Python 2.2

The main intent is to clarify the usage of the optional arguments.

@cjwhrh cjwhrh mannequin closed this as completed Mar 12, 2002
@cjwhrh cjwhrh mannequin added the docs Documentation in the Doc dir label Mar 12, 2002
@rhettinger
Copy link
Contributor

Logged In: YES
user_id=80475

IMO, the current version is clearer than the re-write.
Also, the docs add further clarity by showing 7 examples.
The proposed documentation style, range([start=0,] stop
[,step=1 ]) is inconsistent with the style used in the rest
of the docs.

A side note, the docstring for range() is shorter and
clearer than both of the above:

range(...)
    range([start,] stop[, step]) -> list of integers
    
    Return a list containing an arithmetic progression of 
integers.  range(i, j) returns [i, i+1, i+2, ..., j-1]; 
start (!) defaults to 0.  When step is given, it specifies 
the increment (or decrement).  For example, range(4) 
returns [0, 1, 2, 3].  The end point is omitted!  These are 
exactly the valid indices for a list of 4 elements.

@freddrake
Copy link
Member

Logged In: YES
user_id=3066

I agree with Raymond. Closing the bug as rejected.

@ezio-melotti ezio-melotti transferred this issue from another repository Apr 9, 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