lists in breve
"Anand Veeraswamy" <[email protected]> Sat, 3 Sep 2005 18:15:52 +0100
| Newsgroups | gmane.comp.breve |
|---|---|
| Message-ID | <[email protected]> |
This is a multi-part message in MIME format.
--===============54282208221844641==
Content-Type: multipart/alternative;
boundary="----=_NextPart_000_0022_01C5B0B3.84EE6E20"
This is a multi-part message in MIME format.
------=_NextPart_000_0022_01C5B0B3.84EE6E20
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Hi,
I have 2 issues while using lists in breve.
1) If I have a nested list like tempList=3D{ {1,2}, {3,4} }
I am able to access individual elements of this list =
using tempList{0}{0} or tempList{0}{1} which will give 1 and 2 =
respectively
But I am unable to create a nested list using the =
following commands=20
tempList{0}{0} =3D 1
tempList{0}{1} =3D 2
when I try using the above 2 commands I get an error =
saying that the "list index 0 is out of bounds"
Why does this happen??=20
=20
Is there any other method to create nested lists?? I =
need to assign the individual elements of the nested list.
2) In order to over come this issue I started using the push list =
function
I create 2 lists like .....
=20
tempList1 =3D { LifePatch (0A458E38) , LifePatch (0A459080) =
} # LifePatch is the name of the class which inherits the Patch class
tempList2 =3D { LifePatch (0A458E38) , LifePatch (0A458760) =
} # The elements of the list are Patches
=20
Then I use the push function in this way
push tempList1 onto pathList. =20
push tempList2 onto pathList.
Now when I check the pathList I get something like this
pathList =3D { { LifePatch (0A458E38) , LifePatch (0A458760) =
}, [circular list reference 0A49FED0] }
What is Circular list reference??=20
Actually I am using a while loop to implement the above =
coding
while(length3>=3D0): {
i=3D0.
tempList2{i} =3D tempList1{0}.=20
i++. =20
tempList2{i} =3D neighborList{length3}.
push tempList2 onto pathList. # At each iteration the =
list created is pushed=20
length3--.
}
Please help me resolve the above issues.
Thanks and regards,
Anand.
------=_NextPart_000_0022_01C5B0B3.84EE6E20
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2900.2722" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>Hi,</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>I have 2 issues while using lists in=20
breve.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>1) If I have a nested list like =
tempList=3D{=20
{1,2}, {3,4} }</FONT></DIV>
<DIV><FONT face=3DArial size=3D2> =20
I am able to access individual =
elements of=20
this list using tempList{0}{0} or tempList{0}{1} which will give 1 =
and 2=20
respectively</FONT></DIV>
<DIV><FONT face=3DArial size=3D2> =20
But I am unable to create a nested =
list=20
using the following commands </FONT></DIV>
<DIV><FONT face=3DArial=20
size=3D2> &nbs=
p; =20
tempList{0}{0}</FONT> <FONT face=3DArial size=3D2>=3D =
1</FONT></DIV>
<DIV><FONT face=3DArial=20
size=3D2> &nbs=
p; =20
tempList{0}{1} =3D 2</FONT></DIV>
<DIV><FONT face=3DArial size=3D2> =20
when I try using the above 2 =
commands I=20
get an error saying that the "list index 0 is out of =
bounds"</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2> =20
Why does this happen?? =
</FONT></DIV>
<DIV><FONT face=3DArial=20
size=3D2> &nbs=
p; </FONT></DIV>
<DIV><FONT face=3DArial size=3D2> =20
Is there any other method to =
create nested=20
lists?? I need to assign the individual elements of the nested=20
list.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>2) In order to over come this issue I =
started using=20
the push list function</FONT></DIV>
<DIV><FONT face=3DArial size=3D2> =20
I create 2 lists like .....</FONT></DIV>
<DIV><FONT face=3DArial=20
size=3D2> &nbs=
p;=20
</FONT></DIV>
<DIV><FONT face=3DArial size=3D2> =20
tempList1 =3D { LifePatch (0A458E38) , LifePatch=20
(0A459080) } # LifePatch is the name of the class which =
inherits the=20
Patch class</FONT></DIV>
<DIV><FONT face=3DArial=20
size=3D2> &nbs=
p;=20
tempList2 =3D { LifePatch (0A458E38) , LifePatch (0A458760) } =
# The=20
elements of the list are Patches</FONT></DIV>
<DIV><FONT face=3DArial=20
size=3D2> &nbs=
p; </FONT></DIV>
<DIV><FONT face=3DArial size=3D2> =20
Then I use the push function in this=20
way</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2> =20
push tempList1 onto=20
pathList. &nbs=
p;=20
</FONT></DIV>
<DIV><FONT face=3DArial size=3D2> =20
push tempList2 onto pathList.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2> =20
Now when I check the pathList I get something like=20
this</FONT></DIV>
<DIV><FONT face=3DArial size=3D2> =20
pathList =3D { { LifePatch (0A458E38) , LifePatch=20
(0A458760) }, <U><STRONG>[circular list reference 0A49FED0]=20
</STRONG></U>}</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2> =20
<STRONG>What is Circular list reference??=20
</STRONG></FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2> =20
Actually I am using a while loop to implement the =
above=20
coding</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2> =20
while(length3>=3D0):=20
{<BR> &n=
bsp; =20
i=3D0.<BR> &nb=
sp; =20
tempList2{i} =3D tempList1{0}. </FONT></DIV>
<DIV><FONT face=3DArial size=3D2> =20
=20
i++. <BR>  =
; =20
tempList2{i} =3D neighborList{length3}.</FONT><FONT face=3DArial=20
size=3D2><BR> =
=20
push tempList2 onto pathList. # At each iteration the list created =
is=20
pushed=20
<BR> &nb=
sp; =20
length3--.<BR>  =
; =20
}</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>Please help me resolve the above=20
issues.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>Thanks and regards,</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Anand.</FONT></DIV></BODY></HTML>
------=_NextPart_000_0022_01C5B0B3.84EE6E20--
--===============54282208221844641==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
_______________________________________________
breve mailing list
[email protected]
http://lists.spiderland.org/mailman/listinfo/breve
--===============54282208221844641==--