Feature Requests item #846560, was opened at 2003-11-21 13:02 Message generated for change (Comment added) made by apb_4 You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=355470&aid=846560&group_id=5470
Category: Python Interpreter Core Group: None Status: Closed Resolution: Rejected Priority: 5 Submitted By: Alexander Rødseth (alexanro) Assigned to: Michael Hudson (mwh) Summary: Slicing infinity Initial Comment: It would be great to be able to use extended slices instead of range. Here's an example: >>> for i in [0:10:2]: ... print i ... 0 2 4 6 8 A more explicit (but longer) way to write this, could be: for i in infinity[0:10:2]: print i One could alternatively write something like: infinity = range(1000) (but this range is too small) or infinity = range(sys.maxint) (but this gives me a memory-error) or infinity = xrange(sys.maxint) (but xrange cannot be sliced) I've also tried experimenting with iterators and generators, but that would exclude slicing "in thin air" like: for i in [0:10:2]: print i ---------------------------------------------------------------------- Comment By: Adam (apb_4) Date: 2005-01-01 20:28 Message: Logged In: YES user_id=1188305 well u can use a range of 20,000,000 and probably some more although it takes a while. 2mil didn't take too long. ---------------------------------------------------------------------- Comment By: Alexander Rødseth (alexanro) Date: 2003-11-21 13:30 Message: Logged In: YES user_id=679374 Okay, thanks for the checkup! :-) ---------------------------------------------------------------------- Comment By: Michael Hudson (mwh) Date: 2003-11-21 13:25 Message: Logged In: YES user_id=6656 This is basically PEP 204: http://www.python.org/peps/pep-0204.html which has been rejected. I'm not aware of any compelling reasons to restart the discussion. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=355470&aid=846560&group_id=5470 _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com