how to get the ordinal number in list

Chris Angelico rosuav at gmail.com
Mon Aug 11 08:53:39 EDT 2014


On Mon, Aug 11, 2014 at 10:41 PM, Marko Rauhamaa <marko at pacujo.net> wrote:
> Tim Chase <python.list at tim.thechases.com>:
>
>> Pish, such redundancy...everyone knows a C programmer would write
>> that as
>>
>>  x ^= y
>>  y ^= x
>>  x ^= y
>
> Aren't you forgetting something?

I don't think he is. Those are augmented assignments, just as Python
has (although with slightly different semantics in some places). The
semicolons can be omitted in some C REPLs, although they are of course
mandatory in regular code.

ChrisA



More information about the Python-list mailing list