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.1.tar.gz
(2.0 kB
view hashes)
Built Distribution
Close
Hashes for pycollection-1.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 187fac18c218540c640c85d7df6e1486dce1b5a5c623b69e072e17c6fc5560f1 |
|
MD5 | 5d1695fa0f11bdb74b4ae323a53642bc |
|
BLAKE2b-256 | 8b7ae04fbe35da4109a32eeae6cb2e0b665aaad970a24503276ff07a71d086e9 |