Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
czheo committed May 23, 2021
2 parents 26f87da + 2306c1c commit c31fbcc
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,9 @@ from syntax_sugar import is_a, has, to, step, drop
1 /is_a/ int
# equivalent to `isinstance(1, int)`

1 /as_a/ str
# "1"

range(10) /has/ '__iter__'
# equivalent to `hasattr(range(10), "__iter__")`

Expand Down Expand Up @@ -162,6 +165,9 @@ for i in 1 /to/ INF:
# there is a `take` functon which is similar to itertools.islice
# return [1, 2, 3, 4, 5]

1 /to/ ... /take/ 5 /as_a/ list
# ... is equivalent to INF

0 /to/ -INF /step/ 2 /take/ 5 /as_a/ list
# also works with negative infinity.
# return [0, -2, -4, -6, -8]
Expand Down

0 comments on commit c31fbcc

Please sign in to comment.