A callable object is an object which also can act as a function. Some languages allow arrays, hash tables or strings to be functions.
Questions tagged [callable-object]
67 questions
0
votes
2 answers
Spawning threads in a thread with callable object
I've seen this problem on multiple occasions, and it seems it occurs in both Windoes(visual studio) and Linux(gcc).
Here is a streamlined version of it:
class noncopyable
{
public:
noncopyable(int n);
~noncopyable();
noncopyable(const…

Yunsheng Guo
- 85
- 7
0
votes
3 answers
check if string variable name is a javascript fuction of an object
How to check if the string parameter passed in a function is too callable/function but not directly under window..
I know the open/ directly callable function can be checked using the syntax window['functionName']
But how about the member function…

Amit Shah
- 7,771
- 5
- 39
- 55
-1
votes
2 answers
How to Loop a string list?
I’m brand new to coding and have been teaching myself Python. I have been trying to create multiple shopping list, that I can print out in a f-string. My code keeps repeating the f-string by the number of items in the list. No matter what I try, I…
-1
votes
1 answer
how to make an instance of a class callable for multiple times using multiple sets of parentheses in one line
I would like to implement class 'Add' such that return the sum of the arguments passed in a separate set of parentheses using call method and inheritance in python. for example:
>>>Add(10)
10
>>>Add(10)(11)
21
>>>Add(10)(11)(12)
33
I tried this…
-1
votes
1 answer
Explicit conversion of templated functors to specific functors
I have a callable struct Foo defined as
struct Foo {
template
void operator()(T i) const { /* ... */ }
};
and for reasons that are out of scope I would like to statically select which type to call it with avoiding the following…

fdev
- 127
- 12
-2
votes
2 answers
Python TypeError: 'list' object is not callable with a dict dictionary, if boolean
I have a dictionary that converts an index number to a node name. I am trying to check if the name is already in a list. I get an error list 'object not callable'. An image of my code is attached.

LindaK
- 21
- 3
-3
votes
1 answer
Functors and lambdas in C++
std::for_each(my_data.begin(), my_data.end(),
[&result](const auto & what) {
result += what;
});
This is an answer that I got from Quora. I asked why did C++ adopt lambdas. Someone responded with these two pieces of code, the above using…

Bear Bile Farming is Torture
- 4,317
- 4
- 27
- 61