This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author xuancong84
Recipients xuancong84
Date 2021-08-17.03:11:23
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1629169883.67.0.683689066007.issue44930@roundup.psfhosted.org>
In-reply-to
Content
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 latter is even slower. I would like to propose to use something like [1:100:2] to initialize a list, moreover, you can use [1:100:2, 1000:1200:5, 5000:6000, :10] to create a list of multiple segments of ranges, i.e., [1,3,5,...,99,1000,1005,1010,...,1195,5000,5001,5002,...,5999,0,1,2,...,9]. Ranged list creation is quite useful and is often used in multi-thread/multi-processing scheduling or tracked sorting. This is especially useful in deep learning where you want to shuffle the training data but keep track of their corresponding labels. In deep RNN, where every training instance has a different length, after shuffling/sorting, you also need to keep track of their corresponding lengths information and etc. Thanks!
History
Date User Action Args
2021-08-17 03:11:23xuancong84setrecipients: + xuancong84
2021-08-17 03:11:23xuancong84setmessageid: <1629169883.67.0.683689066007.issue44930@roundup.psfhosted.org>
2021-08-17 03:11:23xuancong84linkissue44930 messages
2021-08-17 03:11:23xuancong84create