Skip to content

AWeirdDev/eaterate

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Eaterate

GitHubDocs

Eaterate (eet-uh-rate) is a toolkit of modern Python iterators. Or whatever the hell you wanna call this.

Key features:

  • Fully typed. C'mon, type annotations are just essential these days.
  • Quick protyping. Just chain everything.
  • Flexible. Build your custom iterators.
from eaterate import eater

eat = eater("hi!").enumerate()

for index, char in eat:
    print(index, char)

# Output:
# 0 h
# 1 i
# 2 !

Quick tour

With eaterate, you can use iterators in the easiest way possible:

eat = (
    eater([1, 2])
    .chain([4, 5])
    .map(lambda i: i * 2)
)

# collects to a list
print(eat.collect(list))

# [2, 4, 8, 10]

You can also add separators to your iterator like never before (kind of):

eat = eater([1, 2, 3]).intersperse(500)
for i in eat:
    print(i)

# Output:
# 1
# 500
# 2
# 500
# 3

There are a lot more features to try out! Refer to the Docs for more!

About

Modern Python iterators.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Contributors 2

  •  
  •  

Languages