How to add a current string into an already existing list

Roy Smith roy at panix.com
Sat Nov 2 18:00:30 EDT 2013


In article <mailman.1959.1383429046.18130.python-list at python.org>,
 Chris Angelico <rosuav at gmail.com> wrote:

> On Sun, Nov 3, 2013 at 5:30 AM, Jussi Piitulainen
> <jpiitula at ling.helsinki.fi> wrote:
> > Suppose a database allowed structured values like lists of strings,
> > lists of numbers, or even lists of such lists and more. Then it would
> > actually be a Python issue how best to support that database.
> 
> PostgreSQL supports some higher-level structures like arrays.
> Personally, though, I think the most general representation of a
> Python list in a database is either a varchar field with some form of
> structure (eg the repr of a list), or a separate table with a foreign
> key back to this one.

When you say "database" here, you're really talking about relational 
databases.  There are other kinds.

In MongoDB, for example, storing a list of lists of strings is a 
perfectly reasonable and straight-forward thing to do.  Anything which 
can be represented by bson (which is more or less the same as anything 
which can be represented by json) can be inserted directly.



More information about the Python-list mailing list