functional programming - Repeat function a couple times without for loop in python -


is there way repeat function (and generate tuple) in python 2?

i'm hoping syntax looks like:

x, y = repeat(fxn, 2) 

where fxn takes no arguments , 2 length of output tuple.

you can use generator expressions:

x, y = (fxn() _ in range(2)) 

Comments

Popular posts from this blog

c# - Validate object ID from GET to POST -

node.js - Custom Model Validator SailsJS -

php - Find a regex to take part of Email -