Flatten... or How to determine sequenceability?

Marcin 'Qrczak' Kowalczyk qrczak at knm.org.pl
Sat May 26 15:39:29 EDT 2001


Fri, 25 May 2001 10:44:57 -0400, Noel Rappin <noelrap at yahoo.com> pisze:

> As part of the algorithm, I need to determine whether each object in
> the list is itself a sequence or whether it is an atom.  Using the
> types module would cause me to miss any sequence-like object that
> isn't actually the basic type.  So, what's the best (easiest, most
> foolproof) way to determine whether a Python object is a sequence?

There is no universal and formal distinction between sequences and
atoms. For example strings may be considered either.

IMHO data should not be encoded as a mix of unknown types of atoms
and unknown types of sequences in the first place if it's necessary
to distinguish atoms from sequences, but as something with more
explicitly defined structure.

-- 
 __("<  Marcin Kowalczyk * qrczak at knm.org.pl http://qrczak.ids.net.pl/
 \__/
  ^^                      SYGNATURA ZASTĘPCZA
QRCZAK



More information about the Python-list mailing list