Most efficient solution?

Jay Parlar jparlar at home.com
Mon Jul 16 11:01:31 EDT 2001


> 
>That will teach me to post without testing. This doesn't work at all - items
>from B are removed from the temporary, unnamed list created for A + B.
Hehe, that's what I thought. At first I just assumed you were right and wondered what I was doing wrong ;-)


>A bit neared the truth would be:
>
>A += B
>map(A.remove, B)
>
>But this doesn't really work, either. Only the first occurrence of each
>token in B is removed.
I was thinking the same thing, you're essentially going to always remove only the elements you add by concatenating the 
two lists together.


>It strikes me that if B is large, it might be quicker to build a re pattern
>from its elements, and match on that, rather than use 'in'. I'll give that a
>bash later.
If you do, cool, if not, no worries. Like I said in the original post, any insight is appreciated.

>Cheers,
>Simon Brunning
>TriSystems Ltd.
>sbrunning at trisystems.co.uk
>
>
>
>
>-----------------------------------------------------------------------
>The information in this email is confidential and may be legally privileged.
>It is intended solely for the addressee. Access to this email by anyone else
>is unauthorised. If you are not the intended recipient, any disclosure,
>copying, distribution, or any action taken or omitted to be taken in
>reliance on it, is prohibited and may be unlawful. TriSystems Ltd. cannot
>accept liability for statements made which are clearly the senders own.
>


Jay Parlar
----------------------------------------------------------------
Software Engineering III
McMaster University
Hamilton, Ontario, Canada

"Though there are many paths
At the foot of the mountain
All those who reach the top
See the same moon."






More information about the Python-list mailing list