Patches item #1749857, was opened at 2007-07-08 11:33
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1749857&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Modules
Group: Python 2.6
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Walter Dörwald (doerwalter)
Assigned to: Raymond Hettinger (rhettinger)
Summary: itertools.getitem()

Initial Comment:
This patch adds itertools.getitem() which is basically equivalent to the 
following python code:

_default = object()

def getitem(iterable, index, default=_default):
   try:
      return list(iterable)[index]
   except IndexError:
      if default is _default:
         raise
      return default

but without materializing the complete list. Negative indexes are supported too.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1749857&group_id=5470
_______________________________________________
Patches mailing list
[email protected]
http://mail.python.org/mailman/listinfo/patches

Reply via email to