Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #30489

Re: [python-list] python application file format

Path csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <maniandram01@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.000
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'subject:: [': 0.03; '(at': 0.03; 'received:209.85.223': 0.03; 'elements.': 0.05; 'completeness': 0.07; 'json': 0.07; 'option,': 0.07; 'subject:application': 0.07; 'subject:file': 0.07; 'python': 0.09; 'compact': 0.09; 'port,': 0.09; 'referencing': 0.09; 'sqlite': 0.09; 'to:addr:comp.lang.python': 0.09; 'cc:addr:python-list': 0.10; 'subject:python': 0.11; "'a',": 0.16; "'b',": 0.16; "'c'": 0.16; "(can't": 0.16; '(either': 0.16; ':-d': 0.16; 'appreciated!': 0.16; 'benjamin': 0.16; 'disclaimers': 0.16; 'disclaimers,': 0.16; 'expandable': 0.16; 'identifiers': 0.16; 'instances,': 0.16; 'module?': 0.16; 'pointers,': 0.16; 'portable,': 0.16; 'securities,': 0.16; 'space)': 0.16; 'url:disclosures': 0.16; 'url:jpmorgan': 0.16; 'wrote:': 0.17; 'duplicate': 0.17; 'items.': 0.17; "shouldn't": 0.17; '>>>': 0.18; 'subject:] ': 0.19; 'module': 0.19; 'all,': 0.21; 'struct': 0.22; 'cc:2**0': 0.23; 'work.': 0.23; 'posts': 0.23; 'least': 0.25; 'cc:addr:python.org': 0.25; 'header:In-Reply-To:1': 0.25; 'header :User-Agent:1': 0.26; 'guess': 0.27; 'scale': 0.27; 'accuracy': 0.27; 'converting': 0.27; 'easiest': 0.27; 'options': 0.27; 'subject:list': 0.28; 'pickle': 0.29; 'objects': 0.29; 'probably': 0.29; 'class': 0.29; 'classes': 0.30; 'file': 0.32; 'structure': 0.32; 'could': 0.32; 'problem': 0.33; 'received:google.com': 0.34; 'built-in': 0.35; 'saved': 0.35; 'received:209.85': 0.35; 'something': 0.35; 'but': 0.36; 'should': 0.36; 'received:209': 0.37; 'data': 0.37; 'comment': 0.38; 'object': 0.38; 'sure': 0.38; 'advice': 0.39; 'easily': 0.39; 'subject:-': 0.40; 'think': 0.40; 'your': 0.60; 'different': 0.63; 'information,': 0.63; 'url:email': 0.63; 'other.': 0.64; 'legal': 0.65; 'subject': 0.66; 'purchase': 0.67; 'biggest': 0.71; 'sale': 0.76; 'application?': 0.84; 'compact,': 0.84; 'them)': 0.84
Newsgroups comp.lang.python
Date Sat, 29 Sep 2012 06:35:02 -0700 (PDT)
In-Reply-To <mailman.1582.1348864506.27098.python-list@python.org>
Complaints-To groups-abuse@google.com
Injection-Info glegroupsg2000goo.googlegroups.com; posting-host=122.172.251.217; posting-account=uPFZNQoAAAAm9w7z13q1SjWNKNjztdcD
References <5062F9D6.2060402@abzinc.com> <mailman.1582.1348864506.27098.python-list@python.org>
User-Agent G2/1.0
X-Google-Web-Client true
X-Google-IP 122.172.251.217
MIME-Version 1.0
Subject Re: [python-list] python application file format
From Ramchandra Apte <maniandram01@gmail.com>
To comp.lang.python@googlegroups.com
Content-Type text/plain; charset=ISO-8859-1
Cc "python-list@python.org" <python-list@python.org>
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>
Message-ID <mailman.1622.1348925706.27098.python-list@python.org> (permalink)
Lines 108
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1348925706 news.xs4all.nl 6960 [2001:888:2000:d::a6]:54946
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:30489

Show key headers only | View raw


On Saturday, 29 September 2012 02:05:07 UTC+5:30, Prasad, Ramit  wrote:
> Benjamin Jessup wrote:
> 
> > Hello all,
> 
> > 
> 
> > What do people recommend for a file format for a python desktop
> 
> > application? Data is complex with 100s/1000s of class instances, which
> 
> > reference each other.
> 
> > 
> 
> > Write the file with struct module? (Rebuild object pointers, safe,
> 
> > compact, portable, not expandable without reserved space)
> 
> > 
> 
> > Use cPickle with a module/class whitelist? (Can't easily port, not
> 
> > entirely safe, compact enough, expandable)
> 
> > 
> 
> > Use JSON or similar? (Rebuild object pointers, portable, expandable, size?)
> 
> > 
> 
> > Any advice is greatly appreciated!
> 
> 
> 
> I would think your options are pickle, json or database (either sqlite or 
> 
> something like Postgres). I am unfamiliar with the struct module so I 
> 
> cannot comment on its applicability.
> 
> 
> 
> I would guess that your data would be best saved by using a sqlite 
> 
> database. Your biggest problem might be how the different classes are 
> 
> referencing each other. If you are using identifiers then any of these 
> 
> options will probably work. If you are using aggregation then I know
> 
> that pickle will work (at least for built-in types). JSON will
> 
> keep the structure but duplicate elements.
> 
> 
> 
> 
> 
> >>> a = [ 1,2,3 ]
> 
> >>> b = [ 'a', 'b', 'c' ]
> 
> >>> a.append( b )
> 
> >>> e = [ a,b ]
> 
> >>> s = json.dumps( e ) 
> 
> >>> eret = json.loads( s )
> 
> >>> id(eret[0][3]), id(eret[1]) # Same result for json and simplejson
> 
> (329443808, 327677272) 
> 
> >>> eret[0][3].append( 'o')
> 
> >>> eret[0][3], eret[1]
> 
> ([u'a', u'b', u'c', 'o'], [u'a', u'b', u'c'])
> 
> 
> 
> So pickle will be your easiest option, but I am not sure how well it
> 
> will scale with a large number items. Using sqlite/db should scale well
> 
> but it will take you longer/more effort to create a system for converting 
> 
> your objects to and from the DB.
> 
> 
> 
> 
> 
> 
> 
> This email is confidential and subject to important disclaimers and
> 
> conditions including on offers for the purchase or sale of
> 
> securities, accuracy and completeness of information, viruses,
> 
> confidentiality, legal privilege, and legal entity disclaimers,
> 
> available at http://www.jpmorgan.com/pages/disclosures/email.

Guess I shouldn't read or rely your posts (virus'es could be in them) :-D

Back to comp.lang.python | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

RE: [python-list] python application file format "Prasad, Ramit" <ramit.prasad@jpmorgan.com> - 2012-09-28 20:34 +0000
  Re: [python-list] python application file format Ramchandra Apte <maniandram01@gmail.com> - 2012-09-29 06:35 -0700
  Re: [python-list] python application file format Ramchandra Apte <maniandram01@gmail.com> - 2012-09-29 06:35 -0700

csiph-web