>>>>> "TP" == Tim Peters <tim.one@home.com> writes: TP> Making it a method of the format string would be fine (why the TP> format string? because capturing a bound method object like TP> parse3d = "%d %d %d".whatever TP> would be darned useful, but the other way wouldn't be). TP> Finally, since .scanf() is a rotten method name (like .join() TP> before it, it doesn't make clear which operand is scanned and TP> which format), try something like format.scanning(string) TP> instead. My preference would be to have a separate module with the necessary support. It sure would be easy to add to the language. I imagine something like this: import fileinput import scanf fmt = scanf.Format("%d %d %d") for line in fileinput.intput(): mo = fmt.scan(line) if mo: print mo.group(1, 2, 3) Jeremy
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4