Re: List of objects X Database

2007-10-04 Thread Gerardo Herzig
MindMaster32 wrote: >I am writing a script that has to read data from an ASCII file of >about 50 Mb and do a lot of searches and calculations with that data. >That would be a classic problem solved by the use of a database >(SQLite would suit just fine), but that would require the user to >install

Re: List of objects X Database

2007-10-04 Thread M.-A. Lemburg
MindMaster32 wrote: > I am writing a script that has to read data from an ASCII file of > about 50 Mb and do a lot of searches and calculations with that data. > That would be a classic problem solved by the use of a database > (SQLite would suit just fine), but that would require the user to > ins

Re: List of objects X Database

2007-10-03 Thread Pierre Quentel
On 3 oct, 22:01, MindMaster32 <[EMAIL PROTECTED]> wrote: Hi, Maybe PyDbLite (http://quentel.pierre.free.fr/PyDbLite/index.html) is what you need : a single Python module, compatible with Python 2.3+, that lets you manipulate data in memory You can manage a database like this : import PyDbLite d

Re: List of objects X Database

2007-10-03 Thread Wildemar Wildenburger
Michael Bentley wrote: > > On Oct 3, 2007, at 1:01 PM, MindMaster32 wrote: > >> I am writing a script that has to read data from an ASCII file of >> about 50 Mb and do a lot of searches and calculations with that data. >> That would be a classic problem solved by the use of a database >> (SQLite

Re: List of objects X Database

2007-10-03 Thread Michael Bentley
On Oct 3, 2007, at 1:01 PM, MindMaster32 wrote: > I am writing a script that has to read data from an ASCII file of > about 50 Mb and do a lot of searches and calculations with that data. > That would be a classic problem solved by the use of a database > (SQLite would suit just fine), but that w

Re: List of Objects

2007-04-20 Thread Hendrik van Rooyen
"Steve Holden" wrote: > Steven D'Aprano wrote: > [...] > > > > Forth method: create identical gazelles, then modify them: > > > > list_of_beasties = [Gazelle(defaults) for i in xrange(1000)] > > for i, beastie in enumerate(xrange(1000)): > > list_of_beasties[i] = modify(beastie) > > > N

Re: List of Objects

2007-04-19 Thread 7stud
On Apr 19, 9:18 pm, Paddy <[EMAIL PROTECTED]> wrote: > > # create a list of instances > gazelles= [ Gazelle() for x in range(5)] > Nice. I knew there had to be a way to use a list comprehension, but I couldn't figure it out. -- http://mail.python.org/mailman/listinfo/python-list

Re: List of Objects

2007-04-19 Thread Steve Holden
Steven D'Aprano wrote: [...] > > Forth method: create identical gazelles, then modify them: > > list_of_beasties = [Gazelle(defaults) for i in xrange(1000)] > for i, beastie in enumerate(xrange(1000)): > list_of_beasties[i] = modify(beastie) > Nope, 'sorry, that's Python a's well. Forth u'se

Re: List of Objects

2007-04-19 Thread Alex Martelli
<[EMAIL PROTECTED]> wrote: > Howdy, a (possibly) quick question for anyone willing to listen. > I have a question regarding lists and Classes; I have a class called It looks you don't really want what you're saying: you appear to want a list of INSTANCES of one class, *NOT* a list of CLASSES. E.

Re: List of Objects

2007-04-19 Thread [EMAIL PROTECTED]
These methods work. I didn't think I could create a list of objects like that, however, I stand corrected. Thanks for your quick (and helpful) responses! On Apr 19, 11:22 pm, Steven D'Aprano <[EMAIL PROTECTED]> wrote: > On Thu, 19 Apr 2007 19:58:35 -0700, datamonkey.ryan wrote: > > Howdy, a (poss

Re: List of Objects

2007-04-19 Thread Mel Wilson
[EMAIL PROTECTED] wrote: > Howdy, a (possibly) quick question for anyone willing to listen. > I have a question regarding lists and Classes; I have a class called > "gazelle" with several attributes (color, position, etc.) and I need > to create a herd of them. I want to simulate motion of individu

Re: List of Objects

2007-04-19 Thread Steven D'Aprano
On Thu, 19 Apr 2007 19:58:35 -0700, datamonkey.ryan wrote: > Howdy, a (possibly) quick question for anyone willing to listen. > I have a question regarding lists and Classes; I have a class called > "gazelle" with several attributes (color, position, etc.) and I need > to create a herd of them. I

Re: List of Objects

2007-04-19 Thread DillonCo
On Thursday 19 April 2007, [EMAIL PROTECTED] wrote: > Howdy, a (possibly) quick question for anyone willing to listen. > I have a question regarding lists and Classes; I have a class called > "gazelle" with several attributes (color, position, etc.) and I need > to create a herd of them. I want to

Re: List of Objects

2007-04-19 Thread Paddy
On Apr 20, 3:58 am, [EMAIL PROTECTED] wrote: > Howdy, a (possibly) quick question for anyone willing to listen. > I have a question regarding lists and Classes; I have a class called > "gazelle" with several attributes (color, position, etc.) and I need > to create a herd of them. I want to simulat

Re: List of Objects

2007-04-19 Thread 7stud
[EMAIL PROTECTED] wrote: > > However, Python doesn't support pointers As I understand it, every name in Python is a pointer. class Gazelle(object): def __init__(self): self.x = 0 g_list =[] for x in range(10): g_list.append(Gazelle()) for g in g_list: g.x = 10 print g_list[