Re: Help with Dictionaries and Classes requested please.

2007-08-10 Thread Alex Martelli
Sion Arrowsmith [EMAIL PROTECTED] wrote: special_dragonfly [EMAIL PROTECTED] wrote: if key in FieldsDictionary: FieldsDictionary[key].append(FieldClass(*line.split(,))) else: FieldsDictionary[key]=[FieldClass(*line.split(,))] These four lines can be

Help with Dictionaries and Classes requested please.

2007-08-09 Thread special_dragonfly
Hello, I'm new to this group, I've read through the subject of a lot of the group but can't find anything relevant. Perhaps my question is too basic but I'm still stuck. Classes and Dictionaries. If I have a dictionary, how do I instantiate many instances of a class per dictionary key? Either at

Re: Help with Dictionaries and Classes requested please.

2007-08-09 Thread Peter Otten
special_dragonfly wrote: I'm new to this group, I've read through the subject of a lot of the group but can't find anything relevant. Perhaps my question is too basic but I'm still stuck. Classes and Dictionaries. If I have a dictionary, how do I instantiate many instances of a class per

Re: Help with Dictionaries and Classes requested please.

2007-08-09 Thread special_dragonfly
special_dragonfly [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hello, I'm new to this group, I've read through the subject of a lot of the group but can't find anything relevant. Perhaps my question is too basic but I'm still stuck. Classes and Dictionaries. If I have a

Re: Help with Dictionaries and Classes requested please.

2007-08-09 Thread Bjoern Schliessmann
special_dragonfly wrote: I've managed to solve the problem, I really was just being a dunce. Here's how incase anyone is wondering: class MyClass: def __init__(self): name= dict={} dict[0]=[] dict[0].append(MyClass()) dict[0][0].name=Hello print dict[0][0].name I'm

Re: Help with Dictionaries and Classes requested please.

2007-08-09 Thread Bruno Desthuilliers
special_dragonfly a écrit : (snip) I've managed to solve the problem, I really was just being a dunce. Here's how incase anyone is wondering: class MyClass: def __init__(self): name= dict={} dict[0]=[] dict[0].append(MyClass()) dict[0][0].name=Hello print dict[0][0].name

Re: Help with Dictionaries and Classes requested please.

2007-08-09 Thread special_dragonfly
Bruno Desthuilliers [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] special_dragonfly a écrit : (snip) I've managed to solve the problem, I really was just being a dunce. Here's how incase anyone is wondering: class MyClass: def __init__(self): name= dict={}

Re: Help with Dictionaries and Classes requested please.

2007-08-09 Thread special_dragonfly
special_dragonfly [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Bruno Desthuilliers [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] special_dragonfly a écrit : (snip) I've managed to solve the problem, I really was just being a dunce. Here's how incase anyone is

Re: Help with Dictionaries and Classes requested please.

2007-08-09 Thread Neil Cerutti
On 2007-08-09, special_dragonfly [EMAIL PROTECTED] wrote: Is there anyway for python to consider the values within a string when entering the data into a dictionary. I know that isn't very clear so here's an example: class MyClass(object): def __init__(self,name=,age=):

Re: Help with Dictionaries and Classes requested please.

2007-08-09 Thread Steve Holden
special_dragonfly wrote: special_dragonfly [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Bruno Desthuilliers [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] special_dragonfly a écrit : (snip) I've managed to solve the problem, I really was just being a dunce.

Re: Help with Dictionaries and Classes requested please.

2007-08-09 Thread Ben Finney
special_dragonfly [EMAIL PROTECTED] writes: I've managed to solve the problem, I really was just being a dunce. Doubtful; but at this stage we can't tell, because we still don't know what it is you're actually trying to *do*. Here's how incase anyone is wondering: class MyClass: def

Re: Help with Dictionaries and Classes requested please.

2007-08-09 Thread Bruno Desthuilliers
Neil Cerutti a écrit : On 2007-08-09, special_dragonfly [EMAIL PROTECTED] wrote: Is there anyway for python to consider the values within a string when entering the data into a dictionary. I know that isn't very clear so here's an example: class MyClass(object): def

Re: Help with Dictionaries and Classes requested please.

2007-08-09 Thread Neil Cerutti
On 2007-08-09, Bruno Desthuilliers [EMAIL PROTECTED] wrote: Neil Cerutti a écrit : On 2007-08-09, special_dragonfly [EMAIL PROTECTED] wrote: Is there anyway for python to consider the values within a string when entering the data into a dictionary. I know that isn't very clear so here's an

Re: Help with Dictionaries and Classes requested please.

2007-08-09 Thread Bruno Desthuilliers
special_dragonfly a écrit : Bruno Desthuilliers [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] special_dragonfly a écrit : (snip) (and resnip) Hello To answer first Bjoern: I have a dictionary and a class. The dictionary needs to be filled with multiple instances of the

Re: Help with Dictionaries and Classes requested please.

2007-08-09 Thread special_dragonfly
Ben Finney [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] special_dragonfly [EMAIL PROTECTED] writes: I've managed to solve the problem, I really was just being a dunce. Doubtful; but at this stage we can't tell, because we still don't know what it is you're actually trying to

Re: Help with Dictionaries and Classes requested please.

2007-08-09 Thread Bruno Desthuilliers
Neil Cerutti a écrit : On 2007-08-09, Bruno Desthuilliers [EMAIL PROTECTED] wrote: Neil Cerutti a écrit : On 2007-08-09, special_dragonfly [EMAIL PROTECTED] wrote: Is there anyway for python to consider the values within a string when entering the data into a dictionary. I know that isn't

Re: Help with Dictionaries and Classes requested please.

2007-08-09 Thread Sion Arrowsmith
special_dragonfly [EMAIL PROTECTED] wrote: if key in FieldsDictionary: FieldsDictionary[key].append(FieldClass(*line.split(,))) else: FieldsDictionary[key]=[FieldClass(*line.split(,))] These four lines can be replaced by: FieldsDictionary.setdefault(key,

Re: Help with Dictionaries and Classes requested please.

2007-08-09 Thread Bruno Desthuilliers
special_dragonfly a écrit : Ben Finney [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] special_dragonfly [EMAIL PROTECTED] writes: I've managed to solve the problem, I really was just being a dunce. Doubtful; but at this stage we can't tell, because we still don't know what it