Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #46596
| Path | csiph.com!usenet.pasdenom.info!gegeweb.org!newsfeed.kamp.net!newsfeed.kamp.net!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <js@globe.de> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.002 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'languages,': 0.04; 'third- party': 0.04; '(python': 0.07; 'context': 0.07; 'json': 0.07; 'latter': 0.09; 'newest': 0.09; 'objects)': 0.09; 'solution,': 0.09; 'python': 0.11; '23,': 0.16; 'apis.': 0.16; "can't.": 0.16; 'data)': 0.16; 'develop.': 0.16; 'json,': 0.16; 'received:10.50': 0.16; 'roy': 0.16; 'subject:XML': 0.16; 'subject:class': 0.16; 'wrote:': 0.18; 'module': 0.19; '>>>': 0.22; '(in': 0.22; 'gmbh': 0.22; 'header:User-Agent:1': 0.23; 'certainly': 0.24; 'convenient': 0.24; 'entries': 0.24; 'instead.': 0.24; 'question': 0.24; 'header:In-Reply-To:1': 0.27; 'chris': 0.29; 'am,': 0.29; 'xml': 0.29; 'compared': 0.30; "i'm": 0.30; 'pickle': 0.31; 'releases,': 0.31; 'class': 0.32; 'problem': 0.35; 'objects': 0.35; 'but': 0.35; 'there': 0.35; 'instances': 0.36; 'library.': 0.36; 'url:org': 0.36; 'received:10': 0.37; 'performance': 0.37; 'feed': 0.38; 'to:addr:python-list': 0.38; 'list,': 0.38; 'sure': 0.39; 'to:addr:python.org': 0.39; 'how': 0.40; 'read': 0.60; 'subject:back': 0.60; 'back': 0.62; "you'll": 0.62; 'more': 0.64; 'side': 0.67; 'smith': 0.68; 'article': 0.77; '260': 0.84; 'faster.': 0.84; 'rebert': 0.84; '2013': 0.98 |
| X-Virus-Scanned | Debian amavisd-new at ispconfig-mx01-ha03.globe.de |
| Date | Fri, 31 May 2013 13:21:39 +0200 |
| From | Schneider <js@globe.de> |
| Organization | GLOBE Development GmbH |
| User-Agent | Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130329 Thunderbird/17.0.5 |
| MIME-Version | 1.0 |
| To | python-list@python.org |
| Subject | Re: serialize a class to XML and back |
| References | <519DF151.1080405@globe.de> <mailman.2197.1369600623.3114.python-list@python.org> <roy-D5172C.16482026052013@news.panix.com> |
| In-Reply-To | <roy-D5172C.16482026052013@news.panix.com> |
| Content-Type | text/plain; charset=ISO-8859-1; format=flowed |
| Content-Transfer-Encoding | 8bit |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.2488.1369999368.3114.python-list@python.org> (permalink) |
| Lines | 46 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1369999368 news.xs4all.nl 15958 [2001:888:2000:d::a6]:60300 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:46596 |
Show key headers only | View raw
On 26.05.2013 22:48, Roy Smith wrote: > In article <mailman.2197.1369600623.3114.python-list@python.org>, > Chris Rebert <clp2@rebertia.com> wrote: > >> On May 23, 2013 3:42 AM, "Schneider" <js@globe.de> wrote: >>> Hi list, >>> >>> how can I serialize a python class to XML? Plus a way to get the class >> back from the XML? >> >> There's pyxser: http://pythonhosted.org/pyxser/ >> >>> My aim is to store instances of this class in a database. >> Honestly, I would avoid XML if you can. Consider using JSON (Python >> includes the `json` module in the std lib) or pickle instead. Compared to >> XML: The former is more standardized (in the context of serializing >> objects) and less verbose; the latter is more efficient (if you don't care >> about cross-language accessibility); both have more convenient APIs. > Some other points... > > If you care about efficiency and want to use json, don't use the one > that comes packaged with the standard library. There are lots of > third-party json packages (ujson is the one we use) which are > significantly faster. Not sure if that's true of the newest python > releases, but it was certainly true in 2.6. I think performance can be a problem in future. This question is part of a multi-user rss-reader solution, which I'm going to develop. I want to store the feed entries (+ some additional data) as XML in a database. > The advantage of pickle over json is that pickle can serialize many > types of objects that json can't. The other side of the coin is that > pickle is python-specific, so if you think you'll ever need to read your > data from other languages, pickle is right out. -- GLOBE Development GmbH Königsberger Strasse 260 48157 MünsterGLOBE Development GmbH Königsberger Strasse 260 48157 Münster 0251/5205 390
Back to comp.lang.python | Previous | Next — Previous in thread | Find similar | Unroll thread
Re: serialize a class to XML and back Chris Rebert <clp2@rebertia.com> - 2013-05-26 13:36 -0700
Re: serialize a class to XML and back Roy Smith <roy@panix.com> - 2013-05-26 16:48 -0400
Re: serialize a class to XML and back Irmen de Jong <irmen.NOSPAM@xs4all.nl> - 2013-05-27 00:40 +0200
Re: serialize a class to XML and back Roy Smith <roy@panix.com> - 2013-05-26 20:39 -0400
Re: serialize a class to XML and back Irmen de Jong <irmen.NOSPAM@xs4all.nl> - 2013-05-27 20:45 +0200
Re: serialize a class to XML and back Schneider <js@globe.de> - 2013-05-31 13:21 +0200
csiph-web