forked from micropython/micropython-lib
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
29 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
def partial(func, *args, **kwargs): | ||
def _partial(*more_args, **more_kwargs): | ||
kw = kwargs.copy() | ||
kw.update(more_kwargs) | ||
func(*(args + more_args), **kw) | ||
return _partial |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
srctype = micropython-lib | ||
type = module | ||
version = 0.0.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,18 @@ | ||
import sys | ||
# Remove current dir from sys.path, otherwise distutils will peek up our | ||
# module instead of system one. | ||
# Remove current dir from sys.path, otherwise setuptools will peek up our | ||
# module instead of system. | ||
sys.path.pop(0) | ||
sys.path.insert(0, '..') | ||
from setuptools import setup | ||
import metadata | ||
|
||
NAME = 'functools' | ||
|
||
setup(name='micropython-' + NAME, | ||
version='0.0.0', | ||
description=metadata.desc_dummy(NAME), | ||
url=metadata.url, | ||
author=metadata.author_upy_devels, | ||
author_email=metadata.author_upy_devels_email, | ||
setup(name='micropython-functools', | ||
version='0.0.1', | ||
description='functools module for MicroPython', | ||
long_description="This is a module reimplemented specifically for MicroPython standard library,\nwith efficient and lean design in mind. Note that this module is likely work\nin progress and likely supports just a subset of CPython's corresponding\nmodule. Please help with the development if you are interested in this\nmodule.", | ||
url='https://github.com/micropython/micropython/issues/405', | ||
author='MicroPython Developers', | ||
author_email='micro-python@googlegroups.com', | ||
maintainer='MicroPython Developers', | ||
maintainer_email='micro-python@googlegroups.com', | ||
license='MIT', | ||
py_modules=[NAME]) | ||
py_modules=['functools']) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
from functools import partial | ||
|
||
def foo(x, y, prompt="result:"): | ||
print(prompt, x + y) | ||
|
||
|
||
f = partial(foo, 10, prompt="arg+10:") | ||
f(20) |