magic-list 2.4.0

Creator: bradpython12

Last updated:

Add to Cart

Description:

magiclist 2.4.0

Magic List








Magic List is a module that extends the built-in list type.
Documentation 路 PyPI package 路 How to install 路 Notes for contributors and maintainers

[!NOTE]
Its development is entirely test-driven: it is battery-tested and requires a
test coverage of 100%. It also provides type stubs.

Installation
pip install magic-list

Examples
Fibonacci sequence
Let's write a function that given an integer n, returns the fibonacci sequence up to the n-th member.
For example, fibonacci_sequence(10) would return [0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55].
import operator

from magic_list import L, list

def fibonacci_sequence(n: int) -> list[int]:
# let's start by creating a list with the first two members, 0 and 1.
base = L[0, 1]

# we define a function that we will use to generate the next members of
# the sequence
def next_member(current: list[int]) -> int:
return current.take_right(2).sum()

return base.fill_right(next_member, n - 1)


[!NOTE]
The L[0, 1] notation is a way to construct magic lists nicely.

Contributing
First of all, thank you for taking your time to participate in this project! 馃挄
You might want to check those:

Code of Conduct 路 a document to set standards for respectful and inclusive behavior within the community
README-dev.md 路 documentation to help you familiarize with Magic List's workflow
Feature proposals 路 a list of the proposed features in the past, present and future

License

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Customer Reviews

There are no reviews.