On 1/23/07, Josiah Carlson <jcarlson@uci.edu> wrote:
Whether it is a tuple being passed, or a "magic" container, I don't think it matters; though I would lean towards a tuple because it is 5 less characters to type out, and one fewer data types to worry about.
I had talked to others and the concensus was against the tuples for ugliness. s.split((a,b), c) wasn't a popular choice, but s.split(oneof(a, b), c) reads better.
This has been discussed before in python-dev, I believe the general consensus was that it would be convenient at times, but I also believe the general consensus was "use re";
It seems like we have a history of useful string operations being moved away from "use re" to "dont use re", such that the slightly recent startswith and endswith methods, and even split and replace themselves. I would like to see less reasons for people to worry with regular expressions until they actually need them. If we can provide a better way to get the job done, that seems like a great idea. ALSO The oneof type isn't just a single use thing. Usecode may often make use of it, and other types could benefit such as doing a lookup with d[oneof(1,2,3)] (where order would matter for priority). I think this semantic collection type would be very useful in a number of contexts where we would currently just loop or duplicate code. -- Read my blog! I depend on your acceptance of my opinion! I am interesting! http://ironfroggy-code.blogspot.com/