[issue44930] super-Matlab-style ranged list literal initialization

2021-08-17 Thread wang xuancong
wang xuancong added the comment: Another lazy explanation not wanting to improve anything -- ___ Python tracker ___ ___

[issue44930] super-Matlab-style ranged list literal initialization

2021-08-17 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: I concur with Steven. Before range() and enumerate() were introduced there were discussions about introducing dedicated syntax. But it was decided that builtin functions are more preferable. range() was improved in Python 3, so you do not need to waste

[issue44930] super-Matlab-style ranged list literal initialization

2021-08-16 Thread Steven D'Aprano
Steven D'Aprano added the comment: As a new feature, the absolute earliest we could add this would be Python 3.11. As new syntax, it would need a PEP. https://www.python.org/dev/peps/ -- versions: +Python 3.11 ___ Python tracker

[issue44930] super-Matlab-style ranged list literal initialization

2021-08-16 Thread Steven D'Aprano
Steven D'Aprano added the comment: > Python 3 has removed the capability to create a list from a range. That's incorrect. You can do `list(range(1,100,2))`. But generally, why create a list? range objects support many of the list APIs: - iteration - fast containment tests `x in range(1,

[issue44930] super-Matlab-style ranged list literal initialization

2021-08-16 Thread wang xuancong
New submission from wang xuancong : Different from Python 2, Python 3 has removed the capability to create a list from a range. In Python 2, we can use range(1,100,2) to create a list [1, 3, 5, ..., 99], but in Python 3, we can only use list(range(1,100,2)) or [*range(1,100,2)] where the