On 15 February 2017 at 00:41, Nick Timkovich <prometheus...@gmail.com> wrote:
> Make some shim object that you can index into to get that functionality, > could even call it Z (for the set of all integers). Short, and requires no > new syntax. > > class IndexableRange: > def __getitem__(self, item): > if isinstance(item, slice): > start = item.start if item.start is not None else 0 > step = item.step if item.step is not None else 1 > if item.stop is None: > return itertools.count(start, step) > else: > return range(start, item.stop, step) > else: > return item > > Z = IndexableRange() > > for y in Z[0:10:2]: > print(y) > > > l can, also just make function r(a,b,c) : return range(a,b,c) for example, will look similar. Initially I was by the idea to remove brackets from for statement. Now after looking more at examples I realize what the real issue with the look is. Namely it is the word "in" itself. It is simply too short and that makes a lot of space holes in the lines. And letters 'i' and 'n' sort of suck from readability POV. E.g. compare: for x in 1,10,2: and for x over 1,10,2 : So the latter actually would make it look nicer. But that would probably be even less probable to be implemented. Mikhail
_______________________________________________ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/