Questions tagged [callable]

A task that returns a result and may throw an exception.

The Callable interface is similar to Runnable, in that both are designed for classes whose instances are potentially executed by another thread. A Runnable, however, does not return a result and cannot throw a checked exception.

655 questions
-1
votes
1 answer

'list' object is not callable, not a rename issue

as the title say i have been searching the solution of this problem : TypeError: 'list' object is not callable for a while, but i did find only answers about naming variables with defaults names like, for instance, list. And i think this is not my…
F.Peconi
  • 56
  • 9
-1
votes
1 answer

(TypeError: 'float' object is not callable) when doing math

I am writing a code to calculate all of the energy levels for an electron as it jumps to different orbital levels in the Bohr model. I have some math written, but when I try to run it it says TypeError: 'float' object is not callable. What do I need…
Jack Bay
  • 17
  • 3
-1
votes
2 answers

I get an error - and i'm correct with my punctuations

## Loan problem def mon_pay( prin, an_i, dur ) : n = dur * 12 r = (an_i/100)/12 numerator = r*(1+r)**n dinominator = (1+r)**n - 1 if an_i == 0 : mon_pay = prin/n else : mon_pay = prin *…
-1
votes
1 answer

What is the difference when submitting, class implementing Callable and class which doesn't, to the executor service

I am new to threads topic. I need to submit tasks to the executor service asynchronously and also need to get the responses back. I have tried to examples like below. Case 1: public class Task implements Callable { Integer i; public…
Babulu
  • 334
  • 2
  • 14
-1
votes
1 answer

"List" object is not callable in Python

I wrote the following code with Python but the terminal tells me "list object is not callable". Who know what's wrong with my code? Thanks! c={"a": 10,"b":1,"c":22} tmp=list() for k,v in c.items(): tmp.append((v,k)) print…
-1
votes
1 answer

Callable without executor in java

import java.util.concurrent.Callable; import java.io.IOException; public class HelloWorld{ public static void main(String []args){ Callable callable = new Callable() { public Void call() throws IOException { …
-1
votes
2 answers

"'int' object is not callable" Error When Trying To Plot

Here is my code, import numpy as np import math import matplotlib.pyplot as plt #Voltages V,I = np.genfromtxt('Photocurrent_graph_2.csv', dtype=float, delimiter=',', usecols=(0,2), skiprows=1, unpack=True) z =…
Mack
  • 575
  • 2
  • 7
  • 19
-1
votes
1 answer

TypeError: 'int' object is not callable(Pygame)

I am attempting to make a floor that loads at the bottom of the screen for little platformer. I am doing it the this way also so later on it will be easier(I think) to have the floor load only in the camera versus loading infinitely. I did try to…
ddaniels
  • 242
  • 6
  • 13
-1
votes
3 answers

FutureTask and Callable usage

i have a functionality to implement for which I am thinking about using FutureTask and callable calsses.just want to verify if I can use this and if it is correct to use these classes in such situations. Here it is : I am working on a web…
Shailesh Vaishampayan
  • 1,597
  • 3
  • 22
  • 48
-1
votes
3 answers

How to make a str var callable

What i want is to make a string var callable. I just have a list with different models_names and i want to call their create methods like this way. class Object_model_a: #def ... class Object_model_b: #def ... class Object_model_c: …
jsujar
  • 1
-2
votes
1 answer

Python, user input as a function argument not working: TypeError: 'str' object is not callable

I just started learning Python yesterday, so this is probably a stupid question. Nonetheless I have been searching for the solution for a while and couldn't find it! Here is my very basic program: def year(year): try: print(int(year)) …
Olivier Girardot
  • 269
  • 2
  • 10
-2
votes
1 answer

Returning list from Call() of Callable

Callable's call method is not returning list. Also when a debugger point kept at line 'return strList;' in call(), its not coming there at any point of time. Could someone help, where its getting wrong. Thanks in advance ! private static void…
Khan
  • 949
  • 2
  • 11
  • 26
-2
votes
2 answers

Python code not working: TypeError,'int' object is not callable

The following Python code gives out error : TypeError: 'int' object is not callable. Can anyone help me out? string = "This is a string, but I want to print it backwards" stringLen = len(string) newString = [] while stringLen >= 0: …
-2
votes
1 answer

List IndexOutOfBoundsException occurs when try to get returned object from Future

This question is similar to following existing question. I know IndexOutOfBoundsException is a RuntimeException, therefore it is clear that there is a bug in the code. traversing a List object throws IndexOutOfBounds exception In my case…
Adi
  • 57
  • 1
  • 8
-2
votes
2 answers

Reduce() with a regular function

I want to calculate the product sum of two lists using reduce() and a regular function. The regular function to return the product is defined as: def func(maturity, weight): return maturity * weight and the reduct function is…
1 2 3
43
44