Re: [Tutor] TypeError: 'int' object is not callable

2012-05-16 Thread René Bastian
Le Wed, 16 May 2012 14:37:53 -0600, Modulok a écrit : > On 5/16/12, Greg Christian wrote: > > Can anyone tell me what I am doing wrong here. When trying to call > > the factors function from main with x = factors(Tn), getting the > > error message: “TypeError: 'int' object is not callable”? Any

Re: [Tutor] TypeError: 'int' object is not callable

2012-05-16 Thread Emile van Sebille
On 5/16/2012 1:17 PM Greg Christian said... def factors(n): L = [] for i in range(1, int(n ** 0.5) + 1): if (n % i == 0): L.append(i) return L ... now you've completed defining the function factors... def main(): factors = 0 ... and here you create

Re: [Tutor] TypeError: 'int' object is not callable

2012-05-16 Thread Modulok
On 5/16/12, Greg Christian wrote: > Can anyone tell me what I am doing wrong here. When trying to call the > factors function from main with x = factors(Tn), getting the error message: > “TypeError: 'int' object is not callable”? Any help would be appreciated. > Thanks. > > > def factors(n): >

Re: [Tutor] "TypeError: 'int' object is not callable"??

2004-12-18 Thread Jacob S.
Thanks for the explanation! Jacob Schmidt > Jacob S. wrote: > > Thank you! > > > > Wait, though. > > > > How do I do this? > > > > def differentnoofvars(*args,**kwargs): ## By the way, is it **kwargs or > > **kwds? > > Call it what you like, it's an ordinary function parameter. kwds is commonly

Re: [Tutor] "TypeError: 'int' object is not callable"??

2004-12-17 Thread Kent Johnson
Jacob S. wrote: Thank you! Wait, though. How do I do this? def differentnoofvars(*args,**kwargs): ## By the way, is it **kwargs or **kwds? Call it what you like, it's an ordinary function parameter. kwds is commonly used but you can use kwargs. print kwargs another(kwargs) Should be anoth

Re: [Tutor] "TypeError: 'int' object is not callable"??

2004-12-17 Thread Jacob S.
; > To: Kent Johnson > > Cc: [EMAIL PROTECTED] > > Subject: Re: [Tutor] "TypeError: 'int' object is not callable"?? > > > > Hey, could you give an example? > > Thanks, > > Jacob > > > > > > > > apply() is deprecated; i

Re: [Tutor] "TypeError: 'int' object is not callable"??

2004-12-17 Thread Jacob S.
Thank you! Wait, though. How do I do this? def differentnoofvars(*args,**kwargs): ## By the way, is it **kwargs or **kwds? print kwargs another(kwargs) def another(**kwargs): for x,y in kwagrs.items(): print "%s = %s" % (x,y) a = ['a=2','f=3','t=[1,2,3]'] ## A list of kwa

Re: [Tutor] "TypeError: 'int' object is not callable"??

2004-12-17 Thread Kent Johnson
Jacob S. wrote: Hey, could you give an example? I'll try... Here is range with three explicit arguments >>> range(1, 10, 2) [1, 3, 5, 7, 9] Here is range with the arguments supplied in a list; it does the same thing >>> args = [1, 10, 2] >>> range(*args) [1, 3, 5, 7, 9] Here is an example with z

RE: [Tutor] "TypeError: 'int' object is not callable"??

2004-12-17 Thread Christian Wyglendowski
> -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of Jacob S. > Sent: Friday, December 17, 2004 3:54 PM > To: Kent Johnson > Cc: [EMAIL PROTECTED] > Subject: Re: [Tutor] "TypeError: 'int' object is not callable&qu

Re: [Tutor] "TypeError: 'int' object is not callable"??

2004-12-17 Thread Jacob S.
Hey, could you give an example? Thanks, Jacob > > apply() is deprecated; it has been replaced by 'extended call syntax'. Instead of >apply(fn, args, kwds) > you can now write >fn(*args, **kwds) > > Kent > ___ > Tutor maillist - [EMAIL PROTECTED

Re: [Tutor] "TypeError: 'int' object is not callable"??

2004-12-17 Thread Kent Johnson
Jacob S. wrote: Ha! That's what I was looking for! The builtin apply function! The only way I could send the *args to the function was through a list, and function calls see a list as one argument. The apply argument doesn't! Thanks Bob. apply() is deprecated; it has been replaced by 'extended call

Re: [Tutor] "TypeError: 'int' object is not callable"??

2004-12-16 Thread Jacob S.
Ha! That's what I was looking for! The builtin apply function! The only way I could send the *args to the function was through a list, and function calls see a list as one argument. The apply argument doesn't! Thanks Bob. Jacob Schmidt > At 12:39 PM 12/8/2004, Bob Gailer wrote: > >At 11:27 AM 12/

Re: [Tutor] "TypeError: 'int' object is not callable"??

2004-12-08 Thread Alan Gauld
> Note that SOME languages use () for call. There are other call constructs, > such as: > > DO function WITH parameters (FoxPro, similar in COBOL) > > function parameter or parameter1 function parameter2 (APL) And in Smalltalk: object message: parameter1 : parameter2 : parameter3 Or as an ex

Re: [Tutor] "TypeError: 'int' object is not callable"??

2004-12-08 Thread Bob Gailer
At 12:39 PM 12/8/2004, Bob Gailer wrote: At 11:27 AM 12/8/2004, Dick Moores wrote: My thanks to both Max and Kent. So Python tries, and fails, to see 2() as a function! I also got some help from Note that SOME languages use () for call. There are othe

Re: [Tutor] "TypeError: 'int' object is not callable"??

2004-12-08 Thread Bob Gailer
At 11:27 AM 12/8/2004, Dick Moores wrote: My thanks to both Max and Kent. So Python tries, and fails, to see 2() as a function! I also got some help from Note that SOME languages use () for call. There are other call constructs, such as: DO function

Re: [Tutor] "TypeError: 'int' object is not callable"??

2004-12-08 Thread Dick Moores
My thanks to both Max and Kent. So Python tries, and fails, to see 2() as a function! I also got some help from Dick ___ Tutor maillist - [EMAIL PROTECTED] http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] "TypeError: 'int' object is not callable"??

2004-12-08 Thread Kent Johnson
A callable is something that can be called with functional notation. It can be a function, a class, or in some cases a class instance. In general, any object that has a __call__() special method is callable. The callable() built-in tells you if an object is callable, though you can also just try

Re: [Tutor] "TypeError: 'int' object is not callable"??

2004-12-08 Thread Max Noel
On Dec 8, 2004, at 17:01, Dick Moores wrote: I got this error msg for this line of code: n = -(2(a**3.0)/27.0 - a*b/3.0 + c) (where a = 1, b = 2, c = 3) And was baffled until I realized the line should be n = -(2*(a**3.0)/27.0 - a*b/3.0 + c) But I still don't understand what "callable" means. Can s