"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 dictionary, how do I instantiate many instances of a class per
> dictionary key? Either at run-time or dynamically.
> Can anyone help me please?
> Thank you
> Dominic
>
>

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 sorry if I've wasted anyones time, although if there's a better way of 
doing the above I'd still be interested to know.
Dominic


-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to