Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #109270
| From | Ben Finney <ben+python@benfinney.id.au> |
|---|---|
| Newsgroups | comp.lang.python |
| Subject | Re: Best way to inplace alter a list going into postgres |
| Date | 2016-05-31 14:54 +1000 |
| Message-ID | <mailman.44.1464670453.1839.python-list@python.org> (permalink) |
| References | <705c69aa-f82d-4e03-9d83-bb33ed20ad4d@googlegroups.com> <85r3ci7rpx.fsf@benfinney.id.au> |
Sayth Renshaw <flebber.crue@gmail.com> writes: > What is the best way to inplace alter a list going into a postgres > database using split but being sure that the order of items remains > correct. That's a trick question. The best way to modify fields of a record is not with a list. Instead, you should get the record in the form of a mapping (such as Python's built-in mapping type, ‘dict’) and alter the fields *by name*. Ony when it's time to serialise the data should you then convert it to a list, extracting by the sequence of field names (‘horseattrs’ in your example). -- \ “Firmness in decision is often merely a form of stupidity. It | `\ indicates an inability to think the same thing out twice.” | _o__) —Henry L. Mencken | Ben Finney
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Best way to inplace alter a list going into postgres Sayth Renshaw <flebber.crue@gmail.com> - 2016-05-30 21:27 -0700
Re: Best way to inplace alter a list going into postgres Ben Finney <ben+python@benfinney.id.au> - 2016-05-31 14:54 +1000
Re: Best way to inplace alter a list going into postgres Sayth Renshaw <flebber.crue@gmail.com> - 2016-05-30 22:42 -0700
Re: Best way to inplace alter a list going into postgres Ben Finney <ben+python@benfinney.id.au> - 2016-05-31 15:52 +1000
Re: Best way to inplace alter a list going into postgres Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2016-05-31 15:58 +1000
Re: Best way to inplace alter a list going into postgres Sayth Renshaw <flebber.crue@gmail.com> - 2016-05-30 23:19 -0700
Re: Best way to inplace alter a list going into postgres Sayth Renshaw <flebber.crue@gmail.com> - 2016-05-31 01:46 -0700
Re: Best way to inplace alter a list going into postgres Ben Finney <ben+python@benfinney.id.au> - 2016-06-01 06:10 +1000
csiph-web