Iain King wrote in news:1153323649.171612.74510
@s13g2000cwa.googlegroups.com in comp.lang.python:

> 
> [EMAIL PROTECTED] wrote:

>>          [...]  I need to reference (link) each object to the objects
>> upstream and downstream of it, i.e.
>>
>> supply = supply()
>> compressor = compressor(downstream=combustor, upstream=supply)
>> combuster = combuster(downstream=turbine, upstream=compressor)
>> etc.
>>
>> the problem with this is that I reference 'combustor' before is it
>> created. [...]

> 
> At the top of your code you could put:
> 
> supply = None
> compressor = None
> combuster = None
> turbine = None

That doesn't help.

The variable names will be rebound when assigned to the result of
the contructor calls, but only after the previous binding (None) has 
been passed to some other objects constructor.

IOW the second line of the OP's code would effectively be:

compressor = Compressor(downstream=None, upstream=supply)

Rob.
-- 
http://www.victim-prime.dsl.pipex.com/
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to