[Python-Dev] functions vs methods (was Re: trunc()) (original) (raw)

Daniel Stutzbach daniel at stutzbachenterprises.com
Mon Jan 28 23:28:23 CET 2008


On Jan 28, 2008 4:00 PM, Guido van Rossum <guido at python.org> wrote:

No, using trunc(x) makes it clear that the argument and return value are numbers. Using x.trunc() doesn't.

How often do you expect someone to be looking at code where a trunc() method is being called and the variable could plausibly be both a number or something else? (a Google Code search for "def trunc(self)" lang:python returns 1 hit)

How does the that additional value weigh against the cost of adding another builtin and trying to explain trunc() versus int() to new users?

-- Daniel Stutzbach, Ph.D. President, Stutzbach Enterprises LLC



More information about the Python-Dev mailing list