callable-object Questions

2

Solved

The wording of the question title is probably incorrect and I'll fix it happily from your suggestions. My question can be illustrated by this snippet: #include <array> template <typename ...

17

Solved

I want to know the difference between __init__ and __call__ methods. For example: class test: def __init__(self): self.a = 10 def __call__(self): b = 20
Terrigenous asked 12/3, 2012 at 8:9

7

Solved

Basically, what I want to achieve is compile-time verification (with possibly nice error message) that registered callable (either a function, a lambda, a struct with call operator) has correct sig...
Mcquiston asked 7/12, 2017 at 15:36

1

Solved

I researched this topic and cannot see a clear solution. There is a similar SO question My problem is that I have a class with attr.dataclass and typing_extensions.final annotations and I don't wa...
Jovanjove asked 3/1, 2020 at 14:43

7

Solved

I have some old programs from back in the times when python 3.1 came out. In the program I often used the Callable() to pass a function and it's parameters like this to my TKinter application: tv...
Reimpression asked 14/11, 2017 at 21:5

2

In Julia, what's the best way to determine whether an object is callable? (E.g. is there an analog of python's callable function?) EDIT: Here's what one could wish for: f() = println("Hi") x = [1...
Clatter asked 15/1, 2017 at 7:5

2

I am interested in obtaining a general way to obtain a list of arguments and keyword arguments taken by a callable Python object. This is straight-forward for functions with the inspect.getargspec ...
Westbrooks asked 4/1, 2017 at 21:28

1

Solved

I have various functions in my codebase that take a generic callable object and pass it to a series of nested lambdas before calling it. Example: template <typename TF> void interface(TF&amp...
Chester asked 22/4, 2016 at 11:2

1

Solved

I have a list of numbers. I am trying to filter the list and only keep the positive numbers. I am trying to do it by passing a lambda as an argument. I wonder why I get function mismatch error. ...
Cloraclorinda asked 29/9, 2015 at 9:22
1

© 2022 - 2024 — McMap. All rights reserved.