有没有办法在函数中使用列表理解“语法”来减少计算/调用(有点像 try/catch),例如一种写作方式
customers=dict
for customer in customers:
if movie not in customers[customer]:
customers[customer].append(movie)
作为
for customer in customers:
p.append(movie) if movie not in p=customers[customer]
如果调用/操作p非常繁重,那么它很重要,如果它被调用一次或两次