When iterating over the following generator expression,
fun(i) for i in mylist if i not in setA.union(setB)
is the setA.union method called in each iteration, or only once?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Simple proof using
dismodule:So, for your example it is going to be called in each iteration i.e.
len(mylist)times.