Skip to content

Commit

Permalink
Add slice example.
Browse files Browse the repository at this point in the history
  • Loading branch information
c0fec0de committed Apr 27, 2017
1 parent 3030ca6 commit a6439cb
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions defaultlist.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,13 @@
>>> l
[None, None, 'C', None, None]
Slices and negative indicies are supported likewise
>>> l[1:4]
[None, 'C', None]
>>> l[-3]
'C'
Simple factory functions can be created via `lambda`.
>>> l = defaultlist(lambda: 'empty')
Expand Down Expand Up @@ -50,6 +57,8 @@
9
>>> l
[0, 1, 'C', 3, 4, 8, 9]
"""

import sys
Expand Down

0 comments on commit a6439cb

Please sign in to comment.