I think for readability and speed @oxrock's solution is the best, so here is the code rewritten for python 3+:
def num_factors(n):
results = set()
for i in range(1, int(n**0.5) + 1):
if n % i == 0: results.update([i,int(n/i)])
return results