[Tutor] A mergesort

Chris Down chris at chrisdown.name
Sat Aug 31 18:43:57 CEST 2013


On 2013-08-31 22:00, D.V.N.Sarma డి.వి.ఎన్.శర్మ wrote:
> def merge(a, b):
> if len(a)*len(b) == 0:
> return a+b

Indentation in Python matters; if you're going to post code, you should
probably keep it.

> We have to look at the statement as
>
> v = ((a[0] < b[0] and a) or b).pop(0)

This is short circuit evaluation, which is fairly common in programming
languages.[0]

0: https://en.wikipedia.org/wiki/Short-circuit_evaluation
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 490 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/tutor/attachments/20130831/d00dcc34/attachment.sig>


More information about the Tutor mailing list