8000 GitHub - gerard-geer/FloatList: You know, Python lists would just be more fun if you can peek in between elements.
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

gerard-geer/FloatList

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 

Repository files navigation

FloatList

You know, Python lists would just be more fun if you can peek in between elements.

Why

I had a list of values that were sampled from a waveform, and I needed a way to interpolate between them. I also wanted to do something silly.

Examples

>>> from floatlist import FloatList
>>> f = FloatList([0, 4, 5, 6])
>>> f[.125]
0.5
>>> f[.75]
3.0
>>> f[3.0]
6.0
>>> f[-.5]
3.0
>>> f[10000.0]
0.0
>>> f[10001.0]
4.0
>>> f[0.0:1.0:.2]
[0.0, 0.8, 1.6, 2.4000000000000004, 3.2, 4.0]
>>> f
[0, 4, 5, 6]
>>> f[.5] = 2
>>> f
[1.0, 3.0, 5, 6]
>>> f[0] = 0
>>> f[1] = 4
>>> f
[0.0, 4.0, 5, 6]
>>> f[.75] = 1.0
>>> f
[0.25, 1.75, 5, 6]

About

You know, Python lists would just be more fun if you can peek in between elements.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

0