> > Hiya, you might be interested in this alternative config parsing
> > program:
> > http://www.voidspace.org.uk/python/configobj.html
>
> Yes, I know it. But I don't like it. Either a simple ini file do the
> trick, or I need a full blown app-specific DSL - which can be as simple
> as a Python f
'Learning Python' by Lutz and Ascher (excellent book by the way)
explains that a subclass can call its superclass constructor as
follows:
class Super:
def method(self):
# do stuff
class Extender(Super):
def method(self):
Super.method(self) # call the method in super
# do more stu
> >
> > do you mean 'configparser'?
>
> Yes.
>
> > Does it generate objects from the config file automatically?
>
> It generates a representation of the config file as a Python object
> composed of sections and options. The documentation should get you started.
Hiya, you might be interested in thi
> > First case is a little shorter but then you have to use a parser for it
>
> There's one builtin.
do you mean 'configparser'? I'm just trying to figure out how this
works. Does it generate objects from the config file automatically?
Dave
--
http://mail.python.org/mailman/listinfo/python-list
Hi
> Also, I gave the example using Python code as 'config' format, but any
> structured enough text format could do, ie JSON, XML, or even ini-like:
>
> # schema.ini
> objects = turbine1, frobnicator2
>
> [turbine1]
> class=Turbine
> upstream=frobnicator2
> downstream=
>
yes, I like the idea of
Hiya
Could you just talk me through this... is it:
> schema = {'turbine1': {'class': 'Turbine',
>'upstream' : ('frobnicator2',),
>'downstream' : () # nothing,
>},
> 'frobnicator2' : {'class' : 'Frobnicator',
>
Paddy,
thanks for your mail.
> In Digital electronics we have what are called netlists, (and also
> component lists)
yes, years back I did a 3rd year project on a 'logic simulator' which
used the kind of thing you are talking about. I think spice does as
well. Fortunately my problem is a little
> Even if you need to do something during attachment of components it is
> more Pythonic to use properties. So you will write a method in your
> class name something like _set_up(self,upstream_obj) an _get_up(self).
> And then at the end of your class put up=property(_get_up, _set_up).
> You can
Bruno,
Thanks. An issue is that I need to be able to link multiple objects to
a single object etc.
Say for example using the previous wording, I might have compressor -
multiple combustors - turbine
this complicates things slightly.
my current thought is to do a two stage initialisation
1. crea
Iain, thanks - very helpful.
Really I'm trying to write a simulation program that goes through a
number of objects that are linked to one another and does calculations
at each object. The calculations might be backwards or fowards (i.e.
starting at the supply or demand ends of the system and then
I have a problem. I'm writing a simulation program with a number of
mechanical components represented as objects. When I create instances
of objects, I need to reference (link) each object to the objects
upstream and downstream of it, i.e.
supply = supply()
compressor = compressor(downstream=combu
11 matches
Mail list logo