Re: Troubleshooting: re.finditer() creates object even when no match found

2004-12-18 Thread Michael Hoffman
Steven Bethard wrote: first, iterable = peek(iterable) I really like this as a general solution to a problem that bothers me occasionally. IMHO it's much better than having UndoFiles or similar things lying about for every use case. Thanks! -- Michael Hoffman -- http://mail.python.org/mailman/li

Re: Troubleshooting: re.finditer() creates object even when no match found

2004-12-18 Thread Steven Bethard
Nick Coghlan wrote: Nick Coghlan wrote: Chris Lasher wrote: Hello, I really like the finditer() method of the re module. I'm having difficulty at the moment, however, because finditer() still creates a callable-iterator oject, even when no match is found. This is undesirable in cases where I would

Re: Troubleshooting: re.finditer() creates object even when no match found

2004-12-17 Thread Nick Coghlan
Nick Coghlan wrote: Chris Lasher wrote: Hello, I really like the finditer() method of the re module. I'm having difficulty at the moment, however, because finditer() still creates a callable-iterator oject, even when no match is found. This is undesirable in cases where I would like to circumvent e

Re: Troubleshooting: re.finditer() creates object even when no match found

2004-12-17 Thread Nick Coghlan
Chris Lasher wrote: Hello, I really like the finditer() method of the re module. I'm having difficulty at the moment, however, because finditer() still creates a callable-iterator oject, even when no match is found. This is undesirable in cases where I would like to circumvent execution of code mea

Re: Troubleshooting: re.finditer() creates object even when no match found

2004-12-17 Thread Steven Bethard
Chris Lasher wrote: Is there any way to request a feature like this from the RE module keepers, whomever they may be? The most direct way would be to go to Python at sourceforge[1] and make a feature request to add peek to itertools. (This is probably the most reasonable location for it.) Reque

Re: Troubleshooting: re.finditer() creates object even when no match found

2004-12-17 Thread Chris Lasher
Thanks Steve, That's odd that there's no built-in method to do this. It seems like it would be a common task. Is there any way to request a feature like this from the RE module keepers, whomever they may be? In the meantime, may I use your code, with accredation to you? Thanks, Chris -- http://ma

Re: Troubleshooting: re.finditer() creates object even when no match found

2004-12-17 Thread Steven Bethard
Chris Lasher wrote: I know that if I place a finditer() object in an iterative for loop, the loop will not execute, but is there some way I can test to see if the object contains no matches in the first place? Basically, you want to peek into an interable. See my recipes: http://aspn.activestate.c

Troubleshooting: re.finditer() creates object even when no match found

2004-12-17 Thread Chris Lasher
Hello, I really like the finditer() method of the re module. I'm having difficulty at the moment, however, because finditer() still creates a callable-iterator oject, even when no match is found. This is undesirable in cases where I would like to circumvent execution of code meant to parse out data