[Tutor] modulo

Dwight Hutto dwightdhutto at gmail.com
Mon Oct 8 02:16:03 CEST 2012


______________________________________________
>>> I'm not a professional programmer, so I might be way off base here.

You mean you haven't dealt with this subject yet...

But what I like about Pythons modulo solution is that I can use it to
right and left shift in lists or tuples, and I will link to the first
element when I right shift past the last element and link to the last
element when I left shift past the first element. In other words I can
consider the last as a chain where the last and the first element are
connected. This I find useful in surprisingly many situations.

It's uised for, what it's used for, until you know the full lower
level implementation/parsing of objects like immutables(tuples), and
mutables(lists,dicts,strings,etc

>>
>>
> Certainly, but you've never had to do that with lists or tuples having
> negative lengths.  It's a negative modulus that I'm complaining about.

Can you show some example code here?

-- 
Best Regards,
David Hutto
CEO: http://www.hitwebdevelopment.com


More information about the Tutor mailing list