still struggling, howto use a list-element as a name ?
Jussi Salmela
tiedon_jano at hotmail.com
Sat Jan 6 17:01:12 EST 2007
Bruno Desthuilliers kirjoitti:
> Stef Mientki a écrit :
>> In the example below, "pin" is an object with a number of properties.
>> Now I want
>> 1- an easy way to create objects that contains a number of these "pin"
>> 2- an multiple way to access these "pin", i.e.
>> device.pin[some_index]
>> device.some_logical_name
>> ad 1:
>> a dictionary (as "pinlist" in the example) seems a very convenient
>> way (from a viewpoint of the device creator).
>> As you can see in the "__init__" section this dictionary can easily be
>> transported to the pin-objects.
>>
>> ad 2:
>> THAT's the problem: how do automate these lines "self.GND = self.pin[0]"
>>
>> I'm also in for other solutions.
>
> I'm afraid I don't understand your design (nor the domain FWIW).
ditto
> <snip>
>
> But the whole thing still looks awfully convulted and kludgy to me, and
> I suspect serious design flaws... Why don't you try and explain your
> real problem, instead of asking how to implement what you *think* is the
> solution ?
ditto
Cheers,
Jussi
More information about the Python-list
mailing list