In a single character string when I try to fetch second character python fails quite verbosely which is correct and expected behavior.
print 'a'[1]
However when I try to fetch an invalid sub sequence range, it fails silently.
print 'a'[1:]
What is the reason for the difference in behavior?
actually
slicingnever generates anyerrorin case ofstringsandlists:for eg.
works fine.
On the other hand, while accesing
Indexesthat are not defined will always raise anIndexErrorin bothstringsandlists: