Starap function exists but it seems there's not such thing as "doublestarmap"
![](https://secure.gravatar.com/avatar/38229508a42f2443dca89e4fa76cd334.jpg?s=120&d=mm&r=g)
Hello. I have a following question: How come there's no such thing in Python like starmap but which unpacks dicts as kwargs for fuction? For example I have a format string like "{param1}, {param2}" and want to get results passing list of dicts for it's .format(). Of course I can do that with genexpr or some lambda with map. But can you clarify why starmap version of map fuction exists and doublestarmap doesn't? Best Regards.
![](https://secure.gravatar.com/avatar/03cdc3c813a8646f783f97f7c66b8f3f.jpg?s=120&d=mm&r=g)
I don't really understand. You can do: '{a} {b}'.format(**{'a': 1}, **{'b': 2}) Is that what you want?
On 10 Apr 2019, at 11:09, Krokosh Nikita <de.lsnk@gmail.com> wrote:
Hello. I have a following question: How come there's no such thing in Python like starmap but which unpacks dicts as kwargs for fuction?
For example I have a format string like "{param1}, {param2}" and want to get results passing list of dicts for it's .format().
Of course I can do that with genexpr or some lambda with map.
But can you clarify why starmap version of map fuction exists and doublestarmap doesn't?
Best Regards.
_______________________________________________ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/
![](https://secure.gravatar.com/avatar/38229508a42f2443dca89e4fa76cd334.jpg?s=120&d=mm&r=g)
I need smth like starstarmap('{a} / {b}/ {c}'.format, [{a:1, b:2, c:3}, {a:4, b:5, c:6}, ...]) On 4/10/19 7:48 PM, Anders Hovmöller wrote:
I don't really understand. You can do:
'{a} {b}'.format(**{'a': 1}, **{'b': 2})
Is that what you want?
On 10 Apr 2019, at 11:09, Krokosh Nikita <de.lsnk@gmail.com> wrote:
Hello. I have a following question: How come there's no such thing in Python like starmap but which unpacks dicts as kwargs for fuction?
For example I have a format string like "{param1}, {param2}" and want to get results passing list of dicts for it's .format().
Of course I can do that with genexpr or some lambda with map.
But can you clarify why starmap version of map fuction exists and doublestarmap doesn't?
Best Regards.
_______________________________________________ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/
![](https://secure.gravatar.com/avatar/7b22467a97b59ad80c4f6d1803b7e86e.jpg?s=120&d=mm&r=g)
robertvandeneynde.be Le mer. 10 avr. 2019 à 12:55, Krokosh Nikita <de.lsnk@gmail.com> a écrit :
I need smth like starstarmap('{a} / {b}/ {c}'.format, [{a:1, b:2, c:3}, {a:4, b:5, c:6}, ...])
That's def starstarmap(f, it): return (f(**x) for x in it) That looks like a recipe, not a basis function ^^
![](https://secure.gravatar.com/avatar/03cdc3c813a8646f783f97f7c66b8f3f.jpg?s=120&d=mm&r=g)
On 10 Apr 2019, at 11:55, Krokosh Nikita <de.lsnk@gmail.com> wrote:
I need smth like starstarmap('{a} / {b}/ {c}'.format, [{a:1, b:2, c:3}, {a:4, b:5, c:6}, ...])
Seems overly specific. Why not merge the dicts then call formal like normal?
On 4/10/19 7:48 PM, Anders Hovmöller wrote: I don't really understand. You can do:
'{a} {b}'.format(**{'a': 1}, **{'b': 2})
Is that what you want?
On 10 Apr 2019, at 11:09, Krokosh Nikita <de.lsnk@gmail.com> wrote:
Hello. I have a following question: How come there's no such thing in Python like starmap but which unpacks dicts as kwargs for fuction?
For example I have a format string like "{param1}, {param2}" and want to get results passing list of dicts for it's .format().
Of course I can do that with genexpr or some lambda with map.
But can you clarify why starmap version of map fuction exists and doublestarmap doesn't?
Best Regards.
_______________________________________________ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/
![](https://secure.gravatar.com/avatar/4c01705256aa2160c1354790e8c154db.jpg?s=120&d=mm&r=g)
10.04.19 12:55, Krokosh Nikita пише:
I need smth like starstarmap('{a} / {b}/ {c}'.format, [{a:1, b:2, c:3}, {a:4, b:5, c:6}, ...])
Use the format_map method of str.
list(map('{a} / {b}/ {c}'.format_map, [{'a':1, 'b':2, 'c':3}, {'a':4, 'b':5, 'c':6}])) ['1 / 2/ 3', '4 / 5/ 6']
participants (4)
-
Anders Hovmöller
-
Krokosh Nikita
-
Robert Vanden Eynde
-
Serhiy Storchaka