Mercurial > magic
changeset 243:e99ad85d9e25
created
| author | 127.0.0.1 |
|---|---|
| date | Sun, 30 Jun 2013 11:08:06 +0200 |
| parents | f7a91de3091d |
| children | eee52d5a4af8 |
| files | ___%2Aslice__ |
| diffstat | 1 files changed, 4 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/___%2Aslice__ Sun Jun 30 11:07:31 2013 +0200 +++ b/___%2Aslice__ Sun Jun 30 11:08:06 2013 +0200 @@ -2,14 +2,18 @@ thing[start:end:step] def get_slice(thing, start=None, end=None, step=None): if step is None and hasattr(thing.__class__, '__getslice__'): + if start is None: start = 0 elif start < 0: start += len(thing) + if end is None: end = sys.maxint elif end < 0: end += len(thing) + return thing.__getslice__(start, end) + return thing[slice(start, end, step)] }}} \ No newline at end of file
