[issue46783] Add a new feature to enumerate(iterable, start=0) built-in function

2022-02-17 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

Thank you for the suggestion, but we will decline.  We looked at this before 
and decided not to go down this path, preferring instead to the keep the 
builtin function simple and focused on its core task of enumeration.

To cover the rarer cases, it is a simple matter to fulfill the need with fast, 
clear code using itertools:

>>> from itertools import count
>>> names = ['eddard', 'catelyn', 'robb', 'sansa', 'arya', 'bram', 'rickon']
>>> for i, name in zip(count(start=7, step=-1), names):
print(i, name)

7 eddard
6 catelyn
5 robb
4 sansa
3 arya
2 bram
1 rickon

--
assignee:  -> rhettinger
nosy: +rhettinger
resolution:  -> rejected
stage:  -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46783] Add a new feature to enumerate(iterable, start=0) built-in function

2022-02-17 Thread Zachary Ware


Change by Zachary Ware :


--
assignee: docs@python -> 
components: +Library (Lib) -Build, Demos and Tools, Documentation, Interpreter 
Core
nosy:  -docs@python, lys.nikolaou
versions:  -Python 3.10, Python 3.7, Python 3.8, Python 3.9

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46783] Add a new feature to enumerate(iterable, start=0) built-in function

2022-02-17 Thread Larry Hastings


Change by Larry Hastings :


--
components:  -Argument Clinic
nosy:  -larry

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46783] Add a new feature to enumerate(iterable, start=0) built-in function

2022-02-17 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

This has nothing to do with the parser so I'm removing the label. Please, next 
time make sure you select the appropriate categories when opening an issue

--
components:  -Parser

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46783] Add a new feature to enumerate(iterable, start=0) built-in function

2022-02-17 Thread Hossein


New submission from Hossein :

Hi everyone. I have an idea which is add a new feature to enumerate(iterable, 
start=0) built-in function. I mean, "start" is ascending by default, we can add 
a feature to this function to change start in descending order.
for example:
enumerate(iterable, start=100, reverse=True)
reverse: If True, the start is reversed.
(100, iterable[0]), (99, iterable[1],), and so on.

--
assignee: docs@python
components: Argument Clinic, Build, Demos and Tools, Documentation, Interpreter 
Core, Parser
messages: 413428
nosy: HosseinRanjbari, docs@python, larry, lys.nikolaou, pablogsal
priority: normal
severity: normal
status: open
title: Add a new feature to enumerate(iterable, start=0) built-in function
type: enhancement
versions: Python 3.10, Python 3.11, Python 3.7, Python 3.8, Python 3.9

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com