What is the best way to join tuples?
Terry Hancock
hancock at anansispaceworks.com
Fri Nov 15 04:01:20 EST 2002
On Thursday 14 November 2002 09:16 pm, dique wrote:
> Thanx Raymond and Terry! Both of you have great solutions.Work like a charm!
Welcome of course. Interesting problem really -- not quite as easy at it
sounded.
> I wonder which is more efficient :p
Hearsay says that list comprehensions are slower than regular loops, but I've
never actually compared them. I doubt the difference is really noticeable.
Raymond's solution appears to be more general.
Personally, I'm more interested in which is clearer. I always find that I
can't write a list comprehension (beyond really trivial cases) until I've
written the solution out as a loop. But after the fact, when I look at the
two, the list comprehension seems clearer (even in this case).
But then I wonder, would it seem clear to someone coming to it fresh?
Terry
--
Terry Hancock ( hancock at anansispaceworks.com )
Anansi Spaceworks http://www.anansispaceworks.com
More information about the Python-list
mailing list