Collection iterator over classes
Project description
collection
Collection is an amazing library that allows you to iterate through a list, but it returns a transformed item. It has a lot of methods to interact with the collection. It works similar than laravel collections. Current version is 1.0.0
Basic usage
class NumberCollection(Collection):
def item(self, item):
return Number(item)
class Number:
def __init__(self, item):
self._item = item
def value(self):
return self._item
numbers = NumberCollection([1,2,3,4,5])
for element in elements:
print(element.value())
# output
# > 1
# > 2
# > 3
# > 4
# > 5
Available methods
methods |
---|
count |
json |
find |
where |
item |
first |
append |
items |
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pycollection-1.0.0.tar.gz
(2.0 kB
view hashes)
Built Distribution
Close
Hashes for pycollection-1.0.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 09d80171cabfb549eca281f1ed796b131ef3e0ebfeb07f903c1952e38e89641f |
|
MD5 | 0f6eb78912eced21de40703cfe76091b |
|
BLAKE2b-256 | 76f705b6de5a0e77aebbcb84e0644b9c1326c27c4fd99824b1be764364361c32 |