From the python documentation docs.python.org/tutorial/introduction.html#strings:
Slice indices have useful defaults; an omitted first index defaults to zero, an omitted second index defaults to the size of the string being sliced.
>>> s = 'mystring'
There actually aren't any defaults; omitted values are treated specially.
However, in every case, omitted values happen to be treated in exactly the same way as None. This means that, unless you're hacking the interpreter (or using the
ast, etc. modules), you can just pretend that the defaults are None (as recursive's answer says), and you'll always get the right answers.
The informal documentation cited isn't quite accurate—which is reasonable for something that's meant to be part of a tutorial. For the real answers, you have to turn to the reference documentation.
For 2.7.3, Sequence Types describes slicing in notes 3, 4, and 5.
… If i is omitted or
0. If j is omitted or
If i or j are omitted or
None, they become “end” values (which end depends on the sign of k). Note, k cannot be zero. If k is
None, it is treated like
For 3.3, Sequence Types has the exact same wording as 2.7.3.