Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Re: simple text parser?

Reply
Thread Tools

Re: simple text parser?

 
 
Alex Martelli
Guest
Posts: n/a
 
      08-17-2003
Brandon J. Van Every wrote:
...
> I'm making a 2D game with a simple "adjacent freeform territories" map. I
> need to make save files for this. I figure I could store the data in
> either
> binary or text. The amount of data to be stored should be small enough
> that
> efficiency and size do not matter. What does matter, is I don't want to
> spend any time at all on this. I want something off-the-shelf.
>
> Can anyone recommend simple text parsers implemented in Python?
>
> Alternately, doesn't Python have some kind of automagical serialization
> pack/unpack functionality? How does that work? I remember reading


As several others appear to have indicated already, cPickle is generally
the best module for serializing your data (e.g. to disk) under the
general conditions you're specifying. The other suggestions (CSV, XML,
and so forth) were based on misunderstanding your specs as meaning you
needed _interoperability_ between Python and C# versions, which you
have later clarified is not the case.


> something about that in the Python docs awhile ago. Before you scream
> RTFM, bear in mind that my current plan is to write versions of this game
> in C# /
> .NET and Python / WhateverWidgets simultaneously. I'm ignorant of both
> platforms, this is an excuse to do a comparo. And, the whole point of
> moving to higher level language development is to minimize pain. Asking
> questions here rather than reinventing the wheel is part of that agenda.
> I want to handle this problem off-the-shelf.


Developing a program under each of two platforms you previously didn't
know is no doubt a good way to compare several characteristics of those
platforms. Out of curiosity -- are you relying on Usenet help, rather
than a manual, for the C# version, too?


Alex

 
Reply With Quote
 
 
 
 
Brandon J. Van Every
Guest
Posts: n/a
 
      08-17-2003
Alex Martelli wrote:
>
> Developing a program under each of two platforms you previously didn't
> know is no doubt a good way to compare several characteristics of
> those platforms. Out of curiosity -- are you relying on Usenet help,
> rather than a manual, for the C# version, too?


Not exactly. I have 2 books on C#, but they don't talk about parsing except
via XML. At some point I will ask about C# parsers, but probably not until
I get stuck on the Python way of doing things.

Cheers,
Brandon

 
Reply With Quote
 
 
 
 
Alex Martelli
Guest
Posts: n/a
 
      08-18-2003
Brandon J. Van Every wrote:

> Alex Martelli wrote:
>>
>> Developing a program under each of two platforms you previously didn't
>> know is no doubt a good way to compare several characteristics of
>> those platforms. Out of curiosity -- are you relying on Usenet help,
>> rather than a manual, for the C# version, too?

>
> Not exactly. I have 2 books on C#, but they don't talk about parsing
> except
> via XML. At some point I will ask about C# parsers, but probably not
> until I get stuck on the Python way of doing things.


I still don't understand why you need parsing for your expressed
purpose (saving data to disk and restoring them, with no effort) --
surely C# has its own object-serialization modules already implemented
for your use, just like Python has cPickle and Java its own serialization
library modules.


Alex

 
Reply With Quote
 
Brandon J. Van Every
Guest
Posts: n/a
 
      08-18-2003
Alex Martelli wrote:
>
> I still don't understand why you need parsing for your expressed
> purpose (saving data to disk and restoring them, with no effort) --
> surely C# has its own object-serialization modules already implemented
> for your use, just like Python has cPickle and Java its own
> serialization library modules.


At this point I agree with you. I don't know about C#'s features, I'll be
finding out.


--
Cheers, www.3DProgrammer.com
Brandon Van Every Seattle, WA

20% of the world is real.
80% is gobbledygook we make up inside our own heads.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Simple way to go from xml to simple text format mathieu XML 3 01-06-2007 10:18 PM
Controlling text in a Text Area or Text leo ASP General 1 12-05-2005 01:13 AM
Re: Simple Simple question!!! Kevin Spencer ASP .Net 0 06-25-2004 05:25 PM
Re: Simple Simple question!!! ashelley@inlandkwpp.com ASP .Net 0 06-25-2004 04:18 PM
Display text in text box - should be simple, doesn't work Jim Owen ASP .Net 1 07-24-2003 05:37 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57