I keep the I find two dirty methods about it, but I will never really use it. i for i in [afunc (i)] == map (afunc, * zip (* aniter)) for [afunc (* i) i Is there any aromatic, elegant way to express the expression of these expressions? Look for tools that make your life easier. For example, the code you posted is already available. From the document: Create an Interactive Iterator Calculates that it uses arguments used in logic. When used instead of IPAP (), the logic parameters are already divided into Tuples with a single referral (data is pre-zipped). The difference between ipp () and strapp () gives the similarity to the difference between function (a, b) and function (* c). Def Tarmac (function, artificial): #strippe (paw, [(2,5), (3,2), (10,3)]) -> gt; & Gt; Equivalent to: In this map and
filter often interchangeable with an understanding of the list , But reducing the code as <<> code> map and
filter (and besides, in some cases I still prefer functional syntax) Not so easy when you have to work on your arguments, however, I myself have been known through syntactical gymnastics and eventually reading To maintain the integrity, the entire work has to be written.
map illustration unit testing simple, but please keep in mind that real life usage cases can be difficult to express as an understanding of the list.
itertools.starmap (afunc, aniter)
Arguments in RGR for 329000: Product Function (* Args)
itertools < There are also tons of other items hidden in / code>, so I recommend you read through the documentation to see if there is anything that you can use. This section also shows such methods that you can use the functions available in
itertools to resolve various types of problems. Even if you can not find a recipe that solves your exact requirements, then it is possible that you can use some ideas as a source of inspiration.
Comments
Post a Comment