On 14 April 2001, Dinu Gherman said: > I'd like to support Peter's proposal for having *some* kind > of inverse mechanism to string formatting using '%'. Now, that > doesn't mean anything, of course, but no matter what the syn- > tax would look like: I'd prefer having that feature over not > having it and I'll give an example below. But we already have one: re.match (and friends). Regexes are vastly more powerful, predictable, reliable, and (to me at least) comprehensible than scanf() format strings. I've never understood how scanf() works, and I don't see a great burning need to add scanf() to Python. Adding syntactic sugar for scanf() in the form of overloading "/" seems like a *really* bad idea, too. ("%" is a nice operator because printf() format strings use "%" a lot, not because formatting a string has anything remotely to do with modulo arithmetic.) If scanf() really needs to be in Python, write Modules/scanfmodule.c, build it by default, and be done with it. Or *maybe* make it a string method, if enough people think it's useful. Greg -- Greg Ward - just another Python hacker gward@python.net http://starship.python.net/~gward/ When you make your mark in the world, watch out for guys with erasers.
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