Or lacking adequate case law, that's what the FSF et al. would want you to believe, anyhow. Although a bit vaguely drafted in this respect, the copyleft effect of GPL depends on the concept of a derivative work under copyright law. It would be a bit far-fetched to claim that in your example, the combination of the function and the codebase is a derivative of the function you incorporated.
Anyway, because the fact that people think GPL is that extensive is enough to create unnecessary problems, I too prefer MPL, where the copyleft scope is defined very clearly for its use case.