Re: TypeError: 'list' object is not callable

2014-02-06 Thread Jussi Piitulainen
wilsonmo...@gmail.com writes: > Peter Otten wrote: > > wilsonmo...@gmail.com wrote: > > > > > TypeError: 'list' object is not callable > > > > Hint: > > > > > open = [] > > > > [...] > > > > with open(..., &

Re: TypeError: 'list' object is not callable

2014-02-06 Thread Asaf Las
On Thursday, February 6, 2014 11:11:13 AM UTC+2, wilso...@gmail.com wrote: > i follow in > http://www.dyinglovegrape.com/data_analysis/part1/1da3.php > still have error > what is the correct writing? give another name to list 'open' at line 'open= []' change it to dopen or whatever. you make name

Re: TypeError: 'list' object is not callable

2014-02-06 Thread wilsonmonde
Peter Otten於 2014年2月6日星期四UTC+8下午4時22分45秒寫道: > wilsonmo...@gmail.com wrote: > > > > > TypeError: 'list' object is not callable > > > > Hint: > > > > > open = [] > > > > [...] > > > > > with open(...,

Re: TypeError: 'list' object is not callable

2014-02-06 Thread Gary Herron
r(csvfile, delimiter = ",", skipinitialspace=True) count = 0 for row in fastreader: date1.append(row[0]) count = count + 1 TypeError: 'list' object is not callable I'd be glad to help, but I'm not interested in guessing. Pleas take

Re: TypeError: 'list' object is not callable

2014-02-06 Thread Peter Otten
wilsonmo...@gmail.com wrote: > TypeError: 'list' object is not callable Hint: > open = [] [...] > with open(..., "rb") as csvfile: -- https://mail.python.org/mailman/listinfo/python-list

TypeError: 'list' object is not callable

2014-02-06 Thread wilsonmonde
count = 0 for row in fastreader: date1.append(row[0]) count = count + 1 TypeError: 'list' object is not callable -- https://mail.python.org/mailman/listinfo/python-list

Re: [Solved]Re: Help with TypeError: Can't convert 'list' object to str implicitly

2014-02-05 Thread Chris Angelico
On Thu, Feb 6, 2014 at 5:08 PM, Dave Angel wrote: > print('The secretWord is ' + secretWord > print('The secretKey is ' + key )) http://xkcd.com/859/ ChrisA -- https://mail.python.org/mailman/listinfo/python-list

Re:[Solved]Re: Help with TypeError: Can't convert 'list' object to str implicitly

2014-02-05 Thread Dave Angel
dave em Wrote in message: > > > Fixed the error and am now onto the next issue. > > Solution was to return a list (I think) and then break out the components of > the list and put in the variable. Here is how we did it: > > secretWord = getRandomWord(words) > print('The secretWord is ' + str

[Solved]Re: Help with TypeError: Can't convert 'list' object to str implicitly

2014-02-05 Thread dave em
27; + str(len(missedLetters)) > + ' missed guesses and ' + str(len(correctLetters)) + ' correct guesses, the > word was "' + secretWord + '"') > > TypeError: Can't convert 'list' object to str implicitly > > > > -I c

Help with TypeError: Can't convert 'list' object to str implicitly

2014-02-05 Thread dave em
an.py", line 155, in print('You have run out of guesses! \n After ' + str(len(missedLetters)) + ' missed guesses and ' + str(len(correctLetters)) + ' correct guesses, the word was "' + secretWord + '"') TypeError: Can't convert 'li

Re: AttributeError: 'list' object has no attribute 'lower'

2012-09-14 Thread Steven D'Aprano
age[s]". There is no such list, and there never will be, because there is no limit to the number and kind of possible error messages. Instead, you should actually read the error message you see. Python is telling you what the problem is. Pay attention to it. AttributeError: 'list&

Re: AttributeError: 'list' object has no attribute 'lower'

2012-09-14 Thread Chris Angelico
On Sat, Sep 15, 2012 at 1:01 AM, Token Type wrote: > Thanks. By the way, do we have a list of explanations of error message? If > so, whenever we come across error message, we can refer to it and solve the > problem accordingly. Not really, but if you paste the message into Google or DuckDuckGo

Re: AttributeError: 'list' object has no attribute 'lower'

2012-09-14 Thread Token Type
Thanks. By the way, do we have a list of explanations of error message? If so, whenever we come across error message, we can refer to it and solve the problem accordingly. -- http://mail.python.org/mailman/listinfo/python-list

Re: AttributeError: 'list' object has no attribute 'lower'

2012-09-10 Thread Jean-Michel Pichavant
Token Type wrote: In fact, I'm guessing that's your problem. I think you're ending up with a list of lists of strings, when you think you're getting a list of strings. Thanks. You guess right. It turns out that lemma_list is a list of list, as I tested in the previous post. I of

Re: AttributeError: 'list' object has no attribute 'lower'

2012-09-09 Thread Roy Smith
In article , Token Type wrote: > > structures are simple, just plain print will work, but for more > > > > complicated structures, pprint.pprint() is a life saver. > > > > I did try . However, > > >>> pprint.pprint(lemma_list) > > Traceback (most recent call last): > File "", line 1, in

Re: AttributeError: 'list' object has no attribute 'lower'

2012-09-09 Thread Roy Smith
In article <43a68990-d6cf-4362-8c47-b13ce780b...@googlegroups.com>, Token Type wrote: > Thanks very much for all of your tips. Take noun as an example. First, I need > find all the lemma_names in all the synsets whose pos is 'n'. Second, for > each lemma_name, I will check all their sense numb

Re: AttributeError: 'list' object has no attribute 'lower'

2012-09-09 Thread Token Type
> structures are simple, just plain print will work, but for more > > complicated structures, pprint.pprint() is a life saver. > I did try . However, >>> pprint.pprint(lemma_list) Traceback (most recent call last): File "", line 1, in pprint.pprint(lemma_list) NameError: name 'pprint

Re: AttributeError: 'list' object has no attribute 'lower'

2012-09-09 Thread Token Type
> In fact, I'm guessing that's your problem. I think you're ending up > > with a list of lists of strings, when you think you're getting a list of > > strings. > Thanks. You guess right. It turns out that lemma_list is a list of list, as I tested in the previous post. -- http://mail.python

Re: AttributeError: 'list' object has no attribute 'lower'

2012-09-09 Thread Token Type
Thanks very much for all of your tips. Take noun as an example. First, I need find all the lemma_names in all the synsets whose pos is 'n'. Second, for each lemma_name, I will check all their sense number. 1) Surely,we can know the number of synset whose pos is noun by >>> len([synset for syn

Re: AttributeError: 'list' object has no attribute 'lower'

2012-09-08 Thread Cameron Simpson
On 08Sep2012 13:45, Roy Smith wrote: | First, I don't understand this code: | | In article , | Token Type wrote: | > synset_list = list(wn.all_synsets(pos)) | > lemma_list = [synset.lemma_names for synset in synset_list] | | It looks like you're taking an iterable, converting it to a l

Re: AttributeError: 'list' object has no attribute 'lower'

2012-09-08 Thread Roy Smith
In article , Token Type wrote: > I wrote the following function to solve it. However, it pops up > "AttributeError: 'list' object has no attribute 'lower'". Quite confused, I > supposed [synset.lemma_names for synset in synset_list] has made all the &

wordnet NLTK Re: AttributeError: 'list' object has no attribute 'lower'

2012-09-08 Thread Token Type
en(synset_list) >>> average_polysemy('n') 3 > > I wrote the following function to solve it. However, it pops up > "AttributeError: 'list' object has no attribute 'lower'". Quite confused, I > supposed [synset.lemma_names

AttributeError: 'list' object has no attribute 'lower'

2012-09-08 Thread Token Type
semy of nouns, verbs, adjectives, and adverbs according to WordNet.http://nltk.googlecode.com/svn/trunk/doc/book/ch02.html I wrote the following function to solve it. However, it pops up "AttributeError: 'list' object has no attribute 'lower'". Quite confused, I supposed

Re: Is there a way to pring a list object in Python?

2010-11-08 Thread Zeynel
On Oct 31, 2:44 pm, Benjamin Kaplan wrote: > Rep() = Rep object > Rep.all() = Query object > list(Rep.all()) = List of Rep objects. > list(Rep.all())[0] = A single Rep object > list(Rep.all())[0].replist = A list > Thanks! This was very helpful. -- http://mail.python.org/mailman/listinfo/python

Re: Is there a way to pring a list object in Python?

2010-10-31 Thread Benjamin Kaplan
7;][u'a', u'b'][u'a', u'b']. . . > > So, these are the lists in datastore. I want to take one of these > lists and apply list method on it. How do I do that? Thanks. > -- Quite simple. You can apply a list method to a list object by actually

Re: Is there a way to pring a list object in Python?

2010-10-31 Thread Richard Thomas
On Oct 31, 7:04 pm, Zeynel wrote: > On Oct 31, 5:52 am, Dave Angel wrote: > > > > > > > > > > > On 2:59 PM, Zeynel wrote:> class Rep(db.Model): > > >      author = db.UserProperty() > > >      replist = db.ListProperty(str) > > >      unique = db.ListProperty(str) > > >      date = db.DateTimePro

Re: Is there a way to pring a list object in Python?

2010-10-31 Thread Zeynel
On Oct 31, 5:52 am, Dave Angel wrote: > On 2:59 PM, Zeynel wrote:> class Rep(db.Model): > >      author = db.UserProperty() > >      replist = db.ListProperty(str) > >      unique = db.ListProperty(str) > >      date = db.DateTimeProperty(auto_now_add=True) > > > > > > Rep().replist = L > > R

Re: Is there a way to pring a list object in Python?

2010-10-31 Thread Zeynel
On Oct 31, 3:00 am, Richard Thomas wrote: > On Oct 31, 5:42 am, Zeynel wrote: > > > class Rep(db.Model): > >     author = db.UserProperty() > >     replist = db.ListProperty(str) > >     unique = db.ListProperty(str) > >     date = db.DateTimeProperty(auto_now_add=True) > > > > > > Rep().rep

Re: Is there a way to pring a list object in Python?

2010-10-31 Thread Dave Angel
On 2:59 PM, Zeynel wrote: class Rep(db.Model): author = db.UserProperty() replist = db.ListProperty(str) unique = db.ListProperty(str) date = db.DateTimeProperty(auto_now_add=True) Rep().replist = L Rep().put() mylist = Rep().all().fetch(10) I am trying to display myli

Re: Is there a way to pring a list object in Python?

2010-10-31 Thread Richard Thomas
On Oct 31, 5:42 am, Zeynel wrote: > class Rep(db.Model): >     author = db.UserProperty() >     replist = db.ListProperty(str) >     unique = db.ListProperty(str) >     date = db.DateTimeProperty(auto_now_add=True) > > > > Rep().replist = L > Rep().put() > mylist = Rep().all().fetch(10) > > I

Is there a way to pring a list object in Python?

2010-10-30 Thread Zeynel
class Rep(db.Model): author = db.UserProperty() replist = db.ListProperty(str) unique = db.ListProperty(str) date = db.DateTimeProperty(auto_now_add=True) Rep().replist = L Rep().put() mylist = Rep().all().fetch(10) I am trying to display mylist; but I am getting the object.

Re: Re: Re: How to output a complex List object to a file.

2009-06-22 Thread Chris Rebert
On Mon, Jun 22, 2009 at 7:31 PM, bluefisher80 wrote: > Hi > > Thanks for you tip, > > I am generating some code for another python application, > > so is there a better way for code generating? Actually i just need to > generate some list objects to define EDI syntax using python. Well, I would sa

Re: Re: Re: How to output a complex List object to a file.

2009-06-22 Thread bluefisher80
:41 收件人: bluefisher80 抄送: J. Cliff Dyer; python-list 主题: Re: Re: How to output a complex List object to a file. 2009/6/22 bluefisher80 : > > Actually I think i am just looking for > > print >> myFile.py, myListObj Well, that syntax is deprecated. And you'd have to create

Re: Re: How to output a complex List object to a file.

2009-06-22 Thread Chris Rebert
2009/6/22 bluefisher80 : > > Actually I think i am just looking for > > print >> myFile.py, myListObj Well, that syntax is deprecated. And you'd have to create the actual file object. And put it in a variable. So it's more like: f = file("myFile.py", "w") f.write(str(myListObj)) f.close() Howeve

Re: Re: How to output a complex List object to a file.

2009-06-22 Thread bluefisher80
Actually I think i am just looking for print >> myFile.py, myListObj 2009-06-23 bluefisher80 发件人: J. Cliff Dyer 发送时间: 2009-06-22 22:17:12 收件人: Jim Qiu 抄送: python-list 主题: Re: How to output a complex List object to a file. Have you looked at the JSON module? On Mon, 2009

Re: Re: How to output a complex List object to a file.

2009-06-22 Thread bluefisher80
Let me get my question more clear, I want like the "structure" object printed into another python source file, which i will use in other program. The pickled format or even JSONed format does not fullfil my requirement, does it? Do i make it clear, I still need your guides. Jim Detail ste

Re: How to output a complex List object to a file.

2009-06-22 Thread Chris Rebert
On Mon, Jun 22, 2009 at 6:17 AM, Jim Qiu wrote: > Hi all, > > I have a object list list this: > I need to output this "structure" object into a file, how to do that ? Links for the modules mentioned: http://docs.python.org/library/pickle.html http://docs.python.org/library/json.html Cheers, Chr

Re: How to output a complex List object to a file.

2009-06-22 Thread J. Cliff Dyer
Have you looked at the JSON module? On Mon, 2009-06-22 at 21:17 +0800, Jim Qiu wrote: > Hi all, > > I have a object list list this: > > from bots.botsconfig import * > from D96Arecords import recorddefs > from edifactsyntax3 import syntax > > structure=[ > {ID:'UNH',MIN:1,MAX:1,LEVEL:[ > {I

Re: How to output a complex List object to a file.

2009-06-22 Thread Philip Semanchuk
On Jun 22, 2009, at 9:17 AM, Jim Qiu wrote: Hi all, I have a object list list this: from bots.botsconfig import * from D96Arecords import recorddefs from edifactsyntax3 import syntax structure=[ {ID:'UNH',MIN:1,MAX:1,LEVEL:[ {ID:'BGM',MIN:1,MAX:1}, {ID:'DTM',MIN:1,MAX:5}, ...snip...

How to output a complex List object to a file.

2009-06-22 Thread Jim Qiu
Hi all, I have a object list list this: from bots.botsconfig import * from D96Arecords import recorddefs from edifactsyntax3 import syntax structure=[ {ID:'UNH',MIN:1,MAX:1,LEVEL:[ {ID:'BGM',MIN:1,MAX:1}, {ID:'DTM',MIN:1,MAX:5}, {ID:'NAD',MIN:1,MAX:5,LEVEL:[ {ID:'CTA',MIN:0,MAX:5,LEVEL:[

Re: Proposal to Add New Method to List Object: Mutable Sequence Types

2009-05-13 Thread Chris Rebert
On Wed, May 13, 2009 at 1:55 AM, VenkataRamaKrishna Boddu wrote: > Hi All, > > This is my first mail to python-list. > > I just want to propose the idea of introducing a new method for the List > Object in similar lines of Dictionary Object has_key method. has_key has been rem

Proposal to Add New Method to List Object: Mutable Sequence Types

2009-05-13 Thread VenkataRamaKrishna Boddu
Hi All, This is my first mail to python-list. I just want to propose the idea of introducing a new method for the List Object in similar lines of Dictionary Object has_key method. See my below code, It always produces the ValueError, if I want to check whether an item is present or not, then

Re: How to get back a list object from its string representation?

2008-12-31 Thread Gabriel Genellina
En Wed, 31 Dec 2008 04:27:01 -0200, Steven D'Aprano escribió: On Wed, 31 Dec 2008 03:08:29 -0200, Gabriel Genellina wrote: eval is like Pandora´s box, all kind of bad things can come from it. Do not use it with any user-supplied string. If you can restrict the values to be just constants, t

Re: How to get back a list object from its string representation?

2008-12-30 Thread Steven D'Aprano
On Wed, 31 Dec 2008 03:08:29 -0200, Gabriel Genellina wrote: > eval is like Pandora´s box, all kind of bad things can come from it. Do > not use it with any user-supplied string. If you can restrict the values > to be just constants, there is a "safe eval" recipe in > http://code.activestate.com

Re: How to get back a list object from its string representation?

2008-12-30 Thread Gabriel Genellina
En Wed, 31 Dec 2008 02:46:33 -0200, Harish Vishwanath escribió: li = [1,2,3] repr(li) '[1, 2, 3]' Is there a standard way to get back li, from repr(li) ? py> eval('[1, 2, 3]') [1, 2, 3] eval is like Pandora´s box, all kind of bad things can come from it. Do not use it with any user-sup

Re: How to get back a list object from its string representation?

2008-12-30 Thread James Mills
On Wed, Dec 31, 2008 at 2:46 PM, Harish Vishwanath wrote: > Hello, > Consider : li = [1,2,3] repr(li) > '[1, 2, 3]' > Is there a standard way to get back li, from repr(li) ? Normally you would use eval(..) however this is considered by many to be evil and bad practise (especially by me!

How to get back a list object from its string representation?

2008-12-30 Thread Harish Vishwanath
Hello, Consider : >>> li = [1,2,3] >>> repr(li) '[1, 2, 3]' Is there a standard way to get back li, from repr(li) ? Regards, Harish -- http://mail.python.org/mailman/listinfo/python-list

Re: list object

2008-05-11 Thread Larry Hale
On May 10, 12:39 pm, Gandalf <[EMAIL PROTECTED]> wrote: > my manual contain chapter about lists with python. when i try to copy > paste : > > li = ["a", "b", "mpilgrim", "z", "example"] (1) > > it i get this errore: >

Re: list object

2008-05-10 Thread Terry Reedy
t;mpilgrim", "z", "example"] (1) | > | > | > it i get this errore: | > | > "TypeError: 'list' object is not callable" | Remove the "(1)" The '(1)' was almost certainly an 'equation number' or 'l

Re: list object

2008-05-10 Thread member thudfoo
On 5/10/08, Gandalf <[EMAIL PROTECTED]> wrote: > my manual contain chapter about lists with python. when i try to copy > paste : > > li = ["a", "b", "mpilgrim", "z", "example"] (1) > > > it i get this errore: > >

list object

2008-05-10 Thread Gandalf
my manual contain chapter about lists with python. when i try to copy paste : li = ["a", "b", "mpilgrim", "z", "example"] (1) it i get this errore: "TypeError: 'list' object is not callable" i was wondering if their is a

Re: Problems wit List Object

2008-03-27 Thread Gary Herron
aceback (most recent call last): > File "xxx", line 184, in onAddErro > list = self.errorMgr.getList() > TypeError: 'list' object is not callable > > How can I solve it? This error implies that getList is a list, *not* a function which returns a list. If t

Problems wit List Object

2008-03-27 Thread David Anderson
onAddErro list = self.errorMgr.getList() TypeError: 'list' object is not callable How can I solve it? -- http://mail.python.org/mailman/listinfo/python-list

Re: Inheriting from Python list object(type?)

2007-05-24 Thread irstas
On May 23, 10:07 pm, Mangabasi <[EMAIL PROTECTED]> wrote: > This is the winner: > > class Point(list): > def __init__(self, x, y, z = 1): > super(Point, self).__init__([x, y, z]) > self.x = x > self.y = y > self.z = z > > def __getattr__(self, name): >

Re: Inheriting from Python list object(type?)

2007-05-23 Thread Mangabasi
On May 23, 2:24 pm, Lyosha <[EMAIL PROTECTED]> wrote: > On May 23, 12:19 pm, Lyosha <[EMAIL PROTECTED]> wrote: > > > > > On May 23, 12:07 pm, Mangabasi <[EMAIL PROTECTED]> wrote: > > > > On May 23, 1:43 pm, "Jerry Hill" <[EMAIL PROTECTED]> wrote: > > > > > On 23 May 2007 11:31:56 -0700, Mangabasi <

Re: Inheriting from Python list object(type?)

2007-05-23 Thread Mangabasi
On May 23, 2:19 pm, Lyosha <[EMAIL PROTECTED]> wrote: > On May 23, 12:07 pm, Mangabasi <[EMAIL PROTECTED]> wrote: > > > On May 23, 1:43 pm, "Jerry Hill" <[EMAIL PROTECTED]> wrote: > > > > On 23 May 2007 11:31:56 -0700, Mangabasi <[EMAIL PROTECTED]> wrote: > > > > > When I modified this to: > > > >

Re: Inheriting from Python list object(type?)

2007-05-23 Thread Lyosha
On May 23, 12:19 pm, Lyosha <[EMAIL PROTECTED]> wrote: > On May 23, 12:07 pm, Mangabasi <[EMAIL PROTECTED]> wrote: > > > On May 23, 1:43 pm, "Jerry Hill" <[EMAIL PROTECTED]> wrote: > > > > On 23 May 2007 11:31:56 -0700, Mangabasi <[EMAIL PROTECTED]> wrote: > > > > > When I modified this to: > > > >

Re: Inheriting from Python list object(type?)

2007-05-23 Thread Lyosha
On May 23, 12:07 pm, Mangabasi <[EMAIL PROTECTED]> wrote: > On May 23, 1:43 pm, "Jerry Hill" <[EMAIL PROTECTED]> wrote: > > > > > On 23 May 2007 11:31:56 -0700, Mangabasi <[EMAIL PROTECTED]> wrote: > > > > When I modified this to: > > > > class Point(list): > > > def __init__(self,x,y): > > >

Re: Inheriting from Python list object(type?)

2007-05-23 Thread Lyosha
On May 23, 12:07 pm, Mangabasi <[EMAIL PROTECTED]> wrote: > On May 23, 1:43 pm, "Jerry Hill" <[EMAIL PROTECTED]> wrote: > > > > > On 23 May 2007 11:31:56 -0700, Mangabasi <[EMAIL PROTECTED]> wrote: > > > > When I modified this to: > > > > class Point(list): > > > def __init__(self,x,y): > > >

Re: Inheriting from Python list object(type?)

2007-05-23 Thread Lyosha
On May 23, 12:07 pm, Mangabasi <[EMAIL PROTECTED]> wrote: > On May 23, 1:43 pm, "Jerry Hill" <[EMAIL PROTECTED]> wrote: > > > > > On 23 May 2007 11:31:56 -0700, Mangabasi <[EMAIL PROTECTED]> wrote: > > > > When I modified this to: > > > > class Point(list): > > > def __init__(self,x,y): > > >

Re: Inheriting from Python list object(type?)

2007-05-23 Thread Mangabasi
On May 23, 1:43 pm, "Jerry Hill" <[EMAIL PROTECTED]> wrote: > On 23 May 2007 11:31:56 -0700, Mangabasi <[EMAIL PROTECTED]> wrote: > > > When I modified this to: > > > class Point(list): > > def __init__(self,x,y): > > super(Point, self).__init__([x, y]) > > self.x = x > >

Re: Inheriting from Python list object(type?)

2007-05-23 Thread Mangabasi
On May 23, 1:43 pm, "Jerry Hill" <[EMAIL PROTECTED]> wrote: > On 23 May 2007 11:31:56 -0700, Mangabasi <[EMAIL PROTECTED]> wrote: > > > When I modified this to: > > > class Point(list): > > def __init__(self,x,y): > > super(Point, self).__init__([x, y]) > > self.x = x > >

Re: Inheriting from Python list object(type?)

2007-05-23 Thread Jerry Hill
On 23 May 2007 11:31:56 -0700, Mangabasi <[EMAIL PROTECTED]> wrote: > When I modified this to: > > class Point(list): > def __init__(self,x,y): > super(Point, self).__init__([x, y]) > self.x = x > self.y = y > > It worked. Are you sure? >>> p = Point(10, 20) >>> p [10,

Re: Inheriting from Python list object(type?)

2007-05-23 Thread Mangabasi
On May 23, 12:47 pm, "Jerry Hill" <[EMAIL PROTECTED]> wrote: > On 23 May 2007 09:58:36 -0700, Mangabasi <[EMAIL PROTECTED]> wrote: > > > There must be a way to inherit from the list type without having to > > redefine all the methods and attributes that regular lists have. > > Like this: > > class

Re: Inheriting from Python list object(type?)

2007-05-23 Thread Mangabasi
On May 23, 12:47 pm, "Jerry Hill" <[EMAIL PROTECTED]> wrote: > On 23 May 2007 09:58:36 -0700, Mangabasi <[EMAIL PROTECTED]> wrote: > > > There must be a way to inherit from the list type without having to > > redefine all the methods and attributes that regular lists have. > > Like this: > > class

Re: Inheriting from Python list object(type?)

2007-05-23 Thread Mangabasi
On May 23, 12:47 pm, "Jerry Hill" <[EMAIL PROTECTED]> wrote: > On 23 May 2007 09:58:36 -0700, Mangabasi <[EMAIL PROTECTED]> wrote: > > > There must be a way to inherit from the list type without having to > > redefine all the methods and attributes that regular lists have. > > Like this: > > class

Re: Inheriting from Python list object(type?)

2007-05-23 Thread Mangabasi
On May 23, 12:47 pm, "Jerry Hill" <[EMAIL PROTECTED]> wrote: > On 23 May 2007 09:58:36 -0700, Mangabasi <[EMAIL PROTECTED]> wrote: > > > There must be a way to inherit from the list type without having to > > redefine all the methods and attributes that regular lists have. > > Like this: > > class

Re: Inheriting from Python list object(type?)

2007-05-23 Thread km
Hi, u have the answer in ur question itself :) u dont need to redefine list methods again - just inherit from the builtin-list-type. try this with new style classes: code ### class Point(list): def __init__(self,x,y): super(Point, self).__init__() self.x = x self.y

Re: Inheriting from Python list object(type?)

2007-05-23 Thread Jerry Hill
On 23 May 2007 09:58:36 -0700, Mangabasi <[EMAIL PROTECTED]> wrote: > There must be a way to inherit from the list type without having to > redefine all the methods and attributes that regular lists have. Like this: class Point(list): def __init__(self, x, y, z = 1): list.__init__(sel

Inheriting from Python list object(type?)

2007-05-23 Thread Mangabasi
Howdy, I would like to create a Point class that lets me use Point instances like the following example. >>> p = Point(3, 4) >>> p.x 3 >>> p.y 4 >>> p.z 1 >>> p[0] 3 >>> p[1] 4 >>> p[1] = 5 >>> p.y 5 >>> other than the x, y, z attributes, these instances should behave like regular Python lists.

Re: attaching Tkinter Listbox to python list object

2007-03-12 Thread jim-on-linux
On Monday 12 March 2007 20:34, Steve Potter wrote: > I am trying to find some method of attaching a > Listbox object to a list object so as the > contents of the list are changed the contents > of the Listbox will be updated to match. I > have found a few references to something

Re: attaching Tkinter Listbox to python list object

2007-03-12 Thread James Stroud
Steve Potter wrote: > I am trying to find some method of attaching a Listbox object to a > list object so as the contents of the list are changed the contents of > the Listbox will be updated to match. I have found a few references > to something like this in this old

attaching Tkinter Listbox to python list object

2007-03-12 Thread Steve Potter
I am trying to find some method of attaching a Listbox object to a list object so as the contents of the list are changed the contents of the Listbox will be updated to match. I have found a few references to something like this in this old post http://groups.google.com/group/comp.lang.python

Re: Help me override append function of list object

2007-01-30 Thread jeremito
On Jan 30, 10:47 am, Peter Otten <[EMAIL PROTECTED]> wrote: > jeremito wrote: > > I have created a class that inherits from the list object. I want to > > override the append function to allow my class to append several > > copies at the same time with one f

Re: Help me override append function of list object

2007-01-30 Thread Peter Otten
jeremito wrote: > I have created a class that inherits from the list object. I want to > override the append function to allow my class to append several > copies at the same time with one function call. I want to do > something like: > > import copy > > class MyList(

Help me override append function of list object

2007-01-30 Thread jeremito
I have created a class that inherits from the list object. I want to override the append function to allow my class to append several copies at the same time with one function call. I want to do something like: import copy class MyList(list): __init__(self): pass def append(self