Piet van Oostrum wrote:
John Yeung <gallium.arsen...@gmail.com> (JY) wrote:

JY> It takes care of the duplicates, but so does your initial solution,
JY> which I like best:

sorted(a)==sorted(b)

JY> This is concise, clear, and in my opinion, the most Pythonic.  It may
JY> well even be the fastest.  (If you didn't have to match up the numbers
JY> of duplicates, the set solution would be most Pythonic and probably
JY> fastest.)

But it may fail if the list cannot be sorted because it contains
incomparable elements:

Ah .. good point .. something I had not considered. Lucky for me in
this case it's not an issue, but something I'll keep in mind for the
future.

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to