Arc Forumnew | comments | leaders | submitlogin
1 point by mec 6175 days ago | link | parent

Why not return the reverse when going backwards within bounds?

    >>> s="aoeui"
    >>> s[3:1]
    "eoa"
    >>> s[4:-3]
    "ue"
    >>> s[9:-20]
    ''
    >>> s[0:-0]
    'a'
    >>> s[12:42]
    ''


2 points by sjs 6175 days ago | link

That is too magic for my taste. [0:-0] returning the first char is madness. That should be '' no matter what, as 0 == -0 on modern cpus (thankfully).

-----