
Security News
Meet Socket at Black Hat and DEF CON 2025 in Las Vegas
Meet Socket at Black Hat & DEF CON 2025 for 1:1s, insider security talks at Allegiant Stadium, and a private dinner with top minds in software supply chain security.
Pypartial is a simple Python library that allows the use of partial function application notation in native Python. It is extremely useful when trying to write concise and clear code, and extends the ease offered by Python's functional programming features.
Example:
import pypartial #use <_ notation to partial apply functions
binary = int<_(base=2) #you can pass keyword arguemnts
print(binary('101010100101'))
import random
dice=random.randint<_(1, 6) #you can also pass non-keywords
print(dice())
print(dice())
up_to_ten = range<_(_, 11) #you can leave args blank with '_'
print(list(up_to_ten(5)))
import operator
double = operator.mul<_(2)
print(double(7))
class Foo(object):
def bar(self, a, b):
print([a,b])
def egg(self, a, b, c=9):
print([a,b,c])
foo=Foo()
bar7 = foo.bar<_(_, b=7) #works with methods too
bar7(2)
egg1 = foo.egg<_(_, 5)
egg2 = egg1<_(c=9) #you can partially apply multiple times
egg2(6)
print(egg2) #nice string representation
FAQs
Use partial function application in Python
We found that pypartial demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Meet Socket at Black Hat & DEF CON 2025 for 1:1s, insider security talks at Allegiant Stadium, and a private dinner with top minds in software supply chain security.
Security News
CAI is a new open source AI framework that automates penetration testing tasks like scanning and exploitation up to 3,600× faster than humans.
Security News
Deno 2.4 brings back bundling, improves dependency updates and telemetry, and makes the runtime more practical for real-world JavaScript projects.