Flatten... or How to determine sequenceability?
Bob Weiner
bweiner at megapathdsl.net
Fri May 25 14:20:31 EDT 2001
On Fri, 25 May 2001 15:52:28 GMT, lep at aber.ac.uk (Leighton Pritchard) wrote:
> On Fri, 25 May 2001 10:44:57 -0400, Noel Rappin <noelrap at yahoo.com>
> made a brave stab at grammar with:
>
> >I'm writing code that needs to flatten a multi-dimension list or tuple into
> >a single dimension list.
> Funny you should ask this, as there's been a similar thread on the
> Python-Tutor list, in which the following link:
>
> http://aspn.activestate.com/ASPN/Mail/msg/python-Tutor:454781
>
> was mentioned. It contains an excellent flatten() function that might
> do just what you're looking for.
> --
> Leighton Pritchard
> lep at spamfree.aber.ac.uk
My interface.py module in http://www.deepware.com/pub/python/bwcto-interface-00.80.tgz
includes a somewhat more generic and expandable flatten function plus a unique function
(eliminates successive duplicate entries after flattening) and an ancestors function (returns
a flattened inheritance tree for a class or instance).
More information about the Python-list
mailing list