Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #16170

Re: Tree data structure with: single, double and triple children option along with AVM data at each node

Path csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!border3.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail
From Miki Tebeka <miki.tebeka@gmail.com>
Newsgroups comp.lang.python
Subject Re: Tree data structure with: single, double and triple children option along with AVM data at each node
Date Thu, 24 Nov 2011 09:24:24 -0800 (PST)
Organization http://groups.google.com
Lines 5
Message-ID <29675595.296.1322155464662.JavaMail.geo-discussion-forums@vbjs5> (permalink)
References <7548c4b6-f3f1-4f96-9a77-fcb9e0edeed0@s4g2000yqk.googlegroups.com>
Reply-To comp.lang.python@googlegroups.com
NNTP-Posting-Host 75.84.253.172
Mime-Version 1.0
Content-Type text/plain; charset=ISO-8859-1
X-Trace posting.google.com 1322155563 1888 127.0.0.1 (24 Nov 2011 17:26:03 GMT)
X-Complaints-To groups-abuse@google.com
NNTP-Posting-Date Thu, 24 Nov 2011 17:26:03 +0000 (UTC)
In-Reply-To <7548c4b6-f3f1-4f96-9a77-fcb9e0edeed0@s4g2000yqk.googlegroups.com>
Complaints-To groups-abuse@google.com
Injection-Info glegroupsg2000goo.googlegroups.com; posting-host=75.84.253.172; posting-account=uo-8fwoAAACKsFzFX78JHudx1V7WDXZ0
User-Agent G2/1.0
X-Google-Web-Client true
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:16170

Show key headers only | View raw


There a many ways to do this, here's one:

from collections import namedtuple
Tree = namedtuple('Tree', ['feature', 'children'])
t = Tree(1, [Tree('hello', []), Tree(3, [])])

Back to comp.lang.python | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

Tree data structure with: single, double and triple children option along with AVM data at each node nirman longjam <nirmanlongjam@gmail.com> - 2011-11-23 19:50 -0800
  Re: Tree data structure with: single, double and triple children option along with AVM data at each node Miki Tebeka <miki.tebeka@gmail.com> - 2011-11-24 09:24 -0800

csiph-web