What are "len", "dir", "vars"?

I was wondering which language to use when it comes to a function that takes a particular object, acts on it and returns something else. Clearly, these are functions, but I was wondering if there is a more specific term.

Some examples of Python built-in functions that meet this specification are: "len", "dir", "vars"

I thought it was a "predicate", but it seems to be specific to functions that return a boolean.

+3
source share
5 answers

There is no generic term for these kinds of functions, although Python internally uses a “query” for these kinds of functions. I rarely see them being described as anything other than a simple "function."

+6
source

Call their functions. This is what everyone will understand. You can also call them routines, methods or procedures, but sometimes they have specific and different meanings in different languages. But “Function” is what most people will understand, regardless of language (although there may be slight differences with one programming language for the next).

+5
source

, , .

+2

This is the traditional meaning of "function" in a mathematical sense. What you describe, more than anything, should be called a function. To distinguish it from a function that has side effects, you can also call it a "pure function" - this means that the function will always return the same result with the same argument and will not affect anything else.

+2
source

I would call them internal functions.

+1
source

Source: https://habr.com/ru/post/1741334/


All Articles