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

2014-07-11 Thread Alan Gauld
On 11/07/14 12:27, Avishek Mondal wrote: for i in range(1, min(n1+n2)+1): TypeError: 'int' object is not iterable shows up. Could you please tell me where I went wrong? Does it mean that if i in an integer, it will not be iterated? But isn't the code for i in range(1, n) a very frequently

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

2014-07-11 Thread Mark Lawrence
On 11/07/2014 12:27, Avishek Mondal wrote: Hi, I wrote a simple program, as follows- def finddivisor(n1, n2): divisor = () What's wrong with divisor = [] # a list for i in range(1, min(n1+n2)+1): if n1%i == 0 and n2%i==0: divisor = divisor + (i, ) Then divisor.appen

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

2014-07-11 Thread Peter Otten
Avishek Mondal wrote: > Hi, > > I wrote a simple program, as follows- > def finddivisor(n1, n2): > divisor = () > > for i in range(1, min(n1+n2)+1): > if n1%i == 0 and n2%i==0: > divisor = divisor + (i, ) > return divisor > > n1 = eval(input('Enter first number: ')) > n2 = eval(input('Enter sec

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

2014-07-11 Thread Danny Yoo
Hi Avishek: Look at the subexpression within the line that Python says it thinks the error is close to: min(n1 + n2) That looks strange. Take a look at that subexpression again. ___ Tutor maillist - Tutor@python.org To unsubscribe or change subs

Re: [Tutor] TypeError: range() integer end argument expected, got float.

2013-11-29 Thread Steven D'Aprano
On Fri, Nov 29, 2013 at 02:24:49PM -0500, spine...@aol.com wrote: > Hi > > > Newbie at this. I am getting this error: > TypeError: range() integer end argument expected, got float. Note carefully that the error here is with the range() function. In your code, you have: > for payment in ran

Re: [Tutor] TypeError: range() integer end argument expected, got float.

2013-11-29 Thread Dominik George
Hi, > Using python 7.3 I think we must update 'import antigravity' to say something about python-driven flux capacitors :þ ... > def PaymentTable(balance, annualInterestRate, payment): You should not CamelCase function names. > upperbound = round((balance + (monthlyinterest * 12)) / 12, 0) Yo

Re: [Tutor] TypeError: generatePersonID() takes exactly 1 argument (0 given)

2013-11-15 Thread Suhas Bhairav
ve pass an arguments while you're calling it. Eg:def main(): getUserInput () generatePersonID ("Suhas") RegardsSuhas > Date: Thu, 14 Nov 2013 09:24:50 -0800 > From: aklei...@sonic.net > To: tutor@python.org > Subject: Re: [Tutor] TypeError: generatePersonID() takes ex

Re: [Tutor] TypeError: generatePersonID() takes exactly 1 argument (0 given)

2013-11-14 Thread Alex Kleider
On 2013-11-14 07:54, Thabile Rampa wrote: Hi, So I'm learning how to define my own functions, and in an exercise I was given, I get this error: Traceback (most recent call last):   File "X:/X/xxx/X/function_practice.py", line 36, in     main ()   File "X:/X/xxx/X/function_practice.py/

Re: [Tutor] TypeError: generatePersonID() takes exactly 1 argument (0 given)

2013-11-14 Thread Alan Gauld
On 14/11/13 15:54, Thabile Rampa wrote: Hi, So I'm learning how to define my own functions, and in an exercise I was given, I get this error: Traceback (most recent call last): ", line 34, in main generatePersonID () TypeError: generateP

Re: [Tutor] TypeError: generatePersonID() takes exactly 1 argument (0 given)

2013-11-14 Thread Joel Goldstick
On Thu, Nov 14, 2013 at 10:54 AM, Thabile Rampa wrote: > Hi, > > So I'm learning how to define my own functions, and in an exercise I was > given, I get this error: > > Traceback (most recent call last): > File "X:/X/xxx/X/function_practice.py", line 36, in > main () > File "X:/X/xxx/

Re: [Tutor] TypeError: can't multiply sequence by non-int of type 'float'

2013-04-05 Thread Sayan Chatterjee
Thanks all...I realized my mistake!!...:) On 4 April 2013 20:12, Andreas Perstinger wrote: > Sayan Chatterjee wrote: > > >I know this error occurs when one tries to multiply a string with a > >fraction i.e float. In my case , I can't figure out how can a numpy > >floating point array be a stri

Re: [Tutor] TypeError: can't multiply sequence by non-int of type 'float'

2013-04-04 Thread Andreas Perstinger
Sayan Chatterjee wrote: >I know this error occurs when one tries to multiply a string with a >fraction i.e float. In my case , I can't figure out how can a numpy >floating point array be a string. The problem is not that the numpy array is a string but that you append the array to a python list:

Re: [Tutor] TypeError: can't multiply sequence by non-int of type 'float'

2013-04-04 Thread Oscar Benjamin
On 4 April 2013 14:40, Sayan Chatterjee wrote: > Dear All, > > I know this error occurs when one tries to multiply a string with a fraction > i.e float. In my case , I can't figure out how can a numpy floating point > array be a string. Interestingly, the concerned expression gets printed in > th

Re: [Tutor] TypeError: can't multiply sequence by non-int of type 'float'

2013-04-04 Thread Sayan Chatterjee
I attach the script herewith. On 4 April 2013 19:10, Sayan Chatterjee wrote: > Dear All, > > I know this error occurs when one tries to multiply a string with a > fraction i.e float. In my case , I can't figure out how can a numpy > floating point array be a string. Interestingly, the concerne

Re: [Tutor] TypeError: not all arguments converted during string formatting

2012-07-09 Thread Steven D'Aprano
Keitaro Kaoru wrote: [...] TypeError: not all arguments converted during string formatting [...] return self.html % ca cant seem to find out whats wrong with it Try experimenting at the interactive interpreter: [steve@ando ~]$ python Python 2.6.7 (r267:88850, Mar 10 2012,

Re: [Tutor] TypeError: not all arguments converted during string formatting

2012-07-09 Thread Joel Goldstick
On Mon, Jul 9, 2012 at 11:31 AM, Keitaro Kaoru wrote: > Traceback (most recent call last): > File "bot.py", line 351, in > mgr.main() > File "/home/bot/bot/ch.py", line 1672, in main > con._feed(data) > File "/home/bot/bot/ch.py", line 628, in _feed > self._process(food.decode("

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: only length-1 arrays can be converted to Python scalars

2012-01-26 Thread Peter Otten
stm atoc wrote: > Hi, > > I have a question regarding the TypeError. > > I have this script as follows in Python. I have run a program in Fortran: > > # coding: utf-8 > from pylab import * > import numpy > import matplotlib.pyplot as pyplot > import matplotlib.mlab as mlab > > t=3600 > N = 100

Re: [Tutor] TypeError in class destructor

2011-12-10 Thread Mark Lybrand
def __exit__(self, *args): Thanks guys. This is the solution I implemented and it works great. Mark :) ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] TypeError in class destructor

2011-12-10 Thread Andreas Perstinger
On 2011-12-10 20:22, Walter Prins wrote: Is the example wrong, or is this something to do with how Windows handles stdout that is causing this not to work as designed? I am using Python 3.2 on Windows Vista Home Premium. It seems the example may be wrong -- the __exit__ method, as stated by th

Re: [Tutor] TypeError in class destructor

2011-12-10 Thread Walter Prins
Hi Mark, On 10 December 2011 17:54, Mark Lybrand wrote: > > I am working on the Files chapter of Dive into Python 3, and have implemented > the example script at the end of this message.  The first input prints to the > terminal as expected, the second value prints to the file as expected.  The

Re: [Tutor] TypeError when io.open is used

2010-06-27 Thread Marc Tompkins
On Sun, Jun 27, 2010 at 5:13 PM, wrote: > On Sun, 27 Jun 2010 15:56:23 -0700 > Marc Tompkins wrote: > >> On Sun, Jun 27, 2010 at 3:20 PM, wrote: >> >> I don't have any insight into your other piece of code, but here I think >> you >> just need another set of parentheses - so that the string in

Re: [Tutor] TypeError when io.open is used

2010-06-27 Thread petkovas
On Sun, 27 Jun 2010 15:56:23 -0700 Marc Tompkins wrote: On Sun, Jun 27, 2010 at 3:20 PM, wrote: I don't have any insight into your other piece of code, but here I think you just need another set of parentheses - so that the string interpolation is done first, and the result

Re: [Tutor] TypeError when io.open is used

2010-06-27 Thread Steven D'Aprano
On Mon, 28 Jun 2010 08:20:01 am petko...@dir.bg wrote: > The full error message is: > > Traceback : > File "insert_into_db_v9.py", line 55, in >WHERE testtable_n = %s""", data1, > str(os.path.splitext(file)[0])) > TypeError: an integer is required Unfortunately this isn't helpful, be

Re: [Tutor] TypeError when io.open is used

2010-06-27 Thread Marc Tompkins
On Sun, Jun 27, 2010 at 3:20 PM, wrote: > I have tried the following, too: > > from pg8000 import DBAPI > import os > import os.path > import sys > > # !!! that is test data. It must be changed > conn=DBAPI.connect(host="localhost", database="postgres", user="postgres", > password="test") > > #co

Re: [Tutor] TypeError when io.open is used

2010-06-27 Thread petkovas
Can you send the full error text please? I'm not sure which is line 55 and Python normally displays the faulty line as part of the error trace. As it is I can't see any reason for it to fail but I'd like to be sure I'm looking at the right place! Also is there any reason why you explicitly c

Re: [Tutor] TypeError when io.open is used

2010-06-24 Thread Alan Gauld
wrote The error: Traceback : File "insert_into_db_v9.py", line 55, in TypeError: an integer is required Can you send the full error text please? I'm not sure which is line 55 and Python normally displays the faulty line as part of the error trace. As it is I can't see any reason for i

Re: [Tutor] TypeError: Need Help

2009-11-19 Thread Dave Angel
Ali Sina wrote: I have Python 3.0 and I'm trying to learn from a pdf document. I followed its instructions >>but I've encountered a problem in its Pickling chapter. This is the code I've written: import pickle, shelve print('Pickling list.') variety=['sweet','hot','dill'] shape=['wh

Re: [Tutor] TypeError: dict objects are unhashable

2009-03-16 Thread A.T.Hofkamp
Lie Ryan wrote: Emile van Sebille wrote: Mark Tolonen wrote: [dict(n) for n in set(tuple(n.items()) for n in l1)] Anyone know if the ordered items for two different dicts where dicta == dictb is guaranteed the same? I know the ordering is unspecified but you can depend on the sequence of k

Re: [Tutor] TypeError: list objects are unhashable

2009-03-15 Thread Kent Johnson
On Sun, Mar 15, 2009 at 8:27 AM, qsqgeekyog...@tiscali.co.uk wrote: l1 = [{'url': 'ws.geonames.org', 'type': 'findNearby', > 'parameters': [50.101, 10.02]}, {'url': 'ws.geonames.org', > 'type': 'findNearby', 'parameters': [50.101, 10.02]}, > {'url': 'ws.geonames.org',

Re: [Tutor] TypeError: dict objects are unhashable

2009-03-15 Thread Lie Ryan
Emile van Sebille wrote: Mark Tolonen wrote: [dict(n) for n in set(tuple(n.items()) for n in l1)] Anyone know if the ordered items for two different dicts where dicta == dictb is guaranteed the same? I know the ordering is unspecified but you can depend on the sequence of keys matching data

Re: [Tutor] TypeError: dict objects are unhashable

2009-03-14 Thread Emile van Sebille
Mark Tolonen wrote: [dict(n) for n in set(tuple(n.items()) for n in l1)] Anyone know if the ordered items for two different dicts where dicta == dictb is guaranteed the same? I know the ordering is unspecified but you can depend on the sequence of keys matching data and I think it'll also m

Re: [Tutor] TypeError: dict objects are unhashable

2009-03-14 Thread Mark Tolonen
wrote in message news:16014207.1237036582618.javamail.r...@ps26... hi, i have a list which contains duplicate dictionaries. how do i extract the unique items out? l1 = [{'a': 'ddd'}, {'a': 'ddd'}, {'b': 'eee'}, {'c': 'ggg'}] set(l1) TypeError: dict objects are unhashable but, {'a': 'ddd'}

Re: [Tutor] TypeError: unsubscriptable object

2008-09-03 Thread Alan Gauld
Rilindo Foster wrote: The list in question comes in this pair: TotalStoreSales = Revenues + "," + Orders TotalStoreSales = TotalStoreSales.split(",") i Rilindo :-) Why not just TotalStoreSales = [Revenues, Orders] At this point, it has two values, both strings. Did you try a print state

Re: [Tutor] TypeError: unsubscriptable object

2008-09-03 Thread Rilindo Foster
As it turns out, I messed up. TotalStoreSales was returning as a integer, not a list. Which lead me to other issues with the script in question. Doh! Sorry about that and thanks! On Sep 3, 2008, at 4:37 PM, Kent Johnson wrote: On Wed, Sep 3, 2008 at 3:44 PM, Rilindo Foster <[EMAIL PROTE

Re: [Tutor] TypeError: unsubscriptable object

2008-09-03 Thread Kent Johnson
On Wed, Sep 3, 2008 at 3:44 PM, Rilindo Foster <[EMAIL PROTECTED]> wrote: > Hi! Long time reader, first time poster (I think). > > I am trying to do a comparison on a particular list item. The list in > question comes in this pair: > > TotalStoreSales = Revenues + "," + Orders > TotalStoreSales = T

Re: [Tutor] TypeError: not enough arguments for format string

2008-07-02 Thread broek
- Message from [EMAIL PROTECTED] - Date: Wed, 02 Jul 2008 14:32:27 -0400 From: bob gailer <[EMAIL PROTECTED]> [EMAIL PROTECTED] wrote: [snip] In a case like print '%s%s' %42 , 333 ... TypeError: not enough arguments for format string it would be ambiguous whether 3

Re: [Tutor] TypeError: not enough arguments for format string

2008-07-02 Thread bob gailer
[EMAIL PROTECTED] wrote: [snip] In a case like print '%s%s' %42 , 333 ... TypeError: not enough arguments for format string it would be ambiguous whether 333 was intended as a second formatting argument or as a second thing to be printed. Here's where the Language Reference comes in ha

Re: [Tutor] TypeError: not enough arguments for format string

2008-07-02 Thread broek
- Message from [EMAIL PROTECTED] - Date: Wed, 2 Jul 2008 16:49:19 +1200 From: John Fouhy <[EMAIL PROTECTED]> On 02/07/2008, Christopher Spears <[EMAIL PROTECTED]> wrote: File "point.py", line 13, in __str__ point_str = "(%f,%f)" % self.x, self.y TypeError: not enoug

Re: [Tutor] TypeError: not enough arguments for format string

2008-07-01 Thread John Fouhy
On 02/07/2008, Christopher Spears <[EMAIL PROTECTED]> wrote: > File "point.py", line 13, in __str__ > point_str = "(%f,%f)" % self.x, self.y > TypeError: not enough arguments for format string > > Does anyone know what is wrong? I'm sure it is something obvious, but I > can't see it. Hi

Re: [Tutor] TypeError: not enough arguments for format string

2008-07-01 Thread Eric Abrahamsen
On Jul 2, 2008, at 12:36 PM, Christopher Spears wrote: I'm working on problem 13-5 in Core Python Programming (2nd Edition). I am supposed to create point class. Here is what I have so far: #!/usr/bin/python class Point(object): def __init__(self, x=0.0,y=0.0): self.x = float(

Re: [Tutor] TypeError: argument 1 must be string or read-only character buffer, not instance

2008-06-05 Thread Kent Johnson
On Thu, Jun 5, 2008 at 8:06 AM, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: import os from BeautifulSoup import BeautifulSoup file = '/home/david/test/stack.html' html = open(file, 'r') soup = BeautifulSoup(html) table = soup.find('table', {'class': 'order_tbl'}) >>>

Re: [Tutor] TypeError

2008-02-03 Thread Kent Johnson
Seon Kang wrote: > class EnemyPokemon(games.Sprite): > > image = games.load_image("bulbasaur.bmp") > > def __init__(self, speed = 2, odds_change = 200, y = 240): > """ Initialize the Chef object. """ > super(EnemyPokemon, self).__init__(image = EnemyPokemon.image, y > = 2

Re: [Tutor] TypeError

2008-02-03 Thread Kent Johnson
Seon Kang wrote: > Why does it not specify the type? Actually, it is specifying the type of the bad argument, which is itself 'type'. Confusing, I know. Try this: >>> 1+int Traceback (most recent call last): File "", line 1, in : u

Re: [Tutor] TypeError

2008-02-03 Thread Kent Johnson
Seon Kang wrote: > When i tried to run my program, i was given this message > (this is the message in part) > > file "C:Python25\lib\site-packages\livewires\games.py", line 503, in_tick > self.position = ((self._x + self._dx), (self._y + self._dy)) > TypeError: unsopported opernad type(s) for

Re: [Tutor] TypeError in base class __init__ after reload

2008-01-24 Thread Kent Johnson
Oops, sending to the list with this PS: Google 'python reload' for discussion and workarounds. Daniel Knierim wrote: > Hello Pythonistas, > > Running the script 'instantiate_and_reload.py' gives me the error > TypeError: unbound method __init__() must be called with ParentClass > instance a

Re: [Tutor] TypeError: dict objects are unhashable

2006-03-24 Thread Alan Gauld
Ben, Others have addressed the cause of the error, but... > accounts = {} > UserCursor.execute(sqlstr) > rows = UserCursor.fetchall() > UserConn.commit() > for row in rows: >U = row['User'] >P = row['Password'] >InnerDict = {} >

Re: [Tutor] TypeError: dict objects are unhashable

2006-03-24 Thread Hugo González Monteverde
Ben Vinger wrote: > But I get: > TypeError: dict objects are unhashable > Unfortunately, I just can't see what I'm doing wrong > InnerDict = {} InnerDict[U] = P accounts[InnerDict] = U Your logic is not right somewhere around this. I do not have a lot of c

Re: [Tutor] TypeError: dict objects are unhashable

2006-03-24 Thread Tim Golden
[Ben Vinger] | I want to create a dictionary (from SQL usernames) of | the format: | accounts = { | ('psmit', '123456'): 'psmit', | ('rmatt', 'mypass'): 'rmatt', | } Although possible, this structure looks a little topsy-turvy: you're keying the dictionary on the username

Re: [Tutor] TypeError: dict objects are unhashable

2006-03-24 Thread Kent Johnson
Ben Vinger wrote: > Hello > > I want to create a dictionary (from SQL usernames) of > the format: > accounts = { > ('psmit', '123456'): 'psmit', > ('rmatt', 'mypass'): 'rmatt', > } > > So I have: > accounts = {} > UserCursor.execute(sqlstr) > rows = UserC

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

2006-02-17 Thread Chris Hallman
Oh, gee. Do I feel sheepish. I knew I had been staring at the error all along, but yet couldn't see it.Thanks!!On 2/17/06, Kent Johnson <[EMAIL PROTECTED]> wrote:Chris Hallman wrote: >> Here is my script:> input = file(rpath, "r")> for line in file(rpath):> for file in dirList:>   

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

2006-02-17 Thread Kent Johnson
Chris Hallman wrote: > > Here is my script: > input = file(rpath, "r") > for line in file(rpath): > for file in dirList: > filename = file.lower() You use the name 'file' for a global variable. This hides the builtin function 'file'. This is a bit of a gotcha for newbies - t

Re: [Tutor] TypeError: object doesn't support item assignment [ Trying to learn how to enter value in array ]

2006-01-02 Thread Brian van den Broek
John Joseph said unto the world upon 02/01/06 02:48 AM: > Hi All >I am trying to write a program in which I enter > the no of students and then for the students I enter > the marks and later on Display the marks > The script which I wrote is given below , when I run > the program I get

Re: [Tutor] TypeError: can only concatenate list (not "str") to list

2005-01-31 Thread Jacob S.
You can also do... Umm, if you're going to make nmr and pbr the values you're printing, why are you printing the values? Nevermind, look at this instead. BTW, aren't rows the horizontal things on tables? nmr = nmrows[i] pbr = cols[0] print "%s\t%s" % (nmr,pbr) >nmr = nmrows[i] pbr = cols[0] prin

Re: [Tutor] TypeError: can only concatenate list (not "str") to list

2005-01-30 Thread kumar s
>nmr = nmrows[i] > pbr = cols[0] > print nmrow[i] +'\t'+cols[0] nmr = str(nmrows[i]) pbr = cols[0] print nmrow[i]+'\t'+cols[0] will print what you want. k --- Srinivas Iyyer <[EMAIL PROTECTED]> wrote: > Hello group, > I am trying to print rows from two lists together: > > how can i deal with

Re: [Tutor] TypeError I don't understand

2005-01-12 Thread Jacob S.
Danny Yoo solved the problem, but I would like to suggest something. target = '*' + str(living_species[counter]) + '*' replacement = '(' + target + ',*' + str(current_species) + '*)' change these lines to target = "*%s*" % (living_species[counter]) replacement = "(%s*%s*)" % (target,current_spe

Re: [Tutor] TypeError I don't understand

2005-01-12 Thread Danny Yoo
On Wed, 12 Jan 2005, Vincent Wan wrote: > running my program gives me "TypeError: len() of unsized object" Hi Vincent: Ah! Whenever you see something like this, check to see where reassignments to the variable occur: it's possible that one of the assignments isn't doing what you think it's d

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