still struggling, howto use a list-element as a name ?
S.Mientki-nospam at mailbox.kun.nl
Sat Jan 6 23:27:30 CET 2007
Jussi Salmela wrote:
> 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.
>>> 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"
>>> I'm also in for other solutions.
>> I'm afraid I don't understand your design (nor the domain FWIW).
>> 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 ?
thank you all guys.
I'm just doing some exercises in Python,
and therefor I'm trying to rewrite some programs
I've written in other languages into Python.
The first program I tried to convert was a MatLab program,
which could almost be written identical in Python.
Even with my little experience in Python,
I can tell you that it could have been written in Python
in a much better way, but I deliberately did not,
to show other people who are familiar with MatLab.
The second example I'm now exercising with,
is a simulator of (electrical) circuits,
which I build in Delphi
More information about the Python-list