skybuck2...@hotmail.com:
> On Monday, August 13, 2018 at 10:01:37 PM UTC+2, Léo El Amri wrote:
>> On 13/08/2018 21:54, skybuck2...@hotmail.com wrote:
>> > I just had a funny idea how to implement a swap operator for types:
>> > 
>> > A >< B
>> > 
>> > would mean swap A and B.
>> 
>> I think that:
>> 
>> a, b = b, a
>> 
>> is pretty enough
>
> LOL.
>
> A >< B is shorter !

Don't forget the

   (A >:< B)

operator:

   def fib(n):
       curr = prev = 1
       for _ in range(n):
           (curr >:< prev) += prev
       return curr

Obviously, we see immediately the need for the Pythonic improvement:

   def fib(n):
       curr = prev = 1
       for _ in range(n):
           curr >+=< prev
       return curr


Marko
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to