[EMAIL PROTECTED] wrote: > Giovanni> Can't you put the global last-match object into TLS? > > What if you're not using threads?
Hey, that was *my* point. For all the Python programs which don't use multi-threading, having a global match object is a very important shortcut. It allows two main things: having multiple if/elif regexp chains which do not add an indent level each time, and have one less object around to care of. I think that in 99% percent of the times I have been using the re module, I either wanted to use the match object immediatly, or simply didn't care about it (just wanted to know whether there was a match or not). I can't think a *single* case where I stored the match object aside and used it later. Maybe because it's easier to immediately extract the matched substrings and store *those* aside (since, after all, it's the data you wanted to extract). Multi-threading programs could be warned that the global match object is unsafe and they should not use it. If you are really concerned of adding the global match objects for threading programs too, the TLS thingie could be activated on request, but I don't think it's worth. Really, having the match objects is cute and good, but having the fast-path shortcut (which would be taken 99% of times) is good as well. Giovanni Bajo _______________________________________________ Python-3000 mailing list Python-3000@python.org http://mail.python.org/mailman/listinfo/python-3000 Unsubscribe: http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com