[Tutor] Structured files?

Alan Gauld alan.gauld at btinternet.com
Fri Jun 3 02:29:37 CEST 2011


"Steven D'Aprano" <steve at pearwood.info> wrote

>> That makes it hugely wasteful of space which is usually the reason 
>> for using a binary format in the first place.
>
> Meh, who cares whether your 100K of data takes 300K on disk? :)

It depends on your volumes and your platform. About 10 years
ago I bought 10G of storage for a mainframe (remember the
millenium bug?!). At the time a 10G hard drive for a PC was
about $100. For the big iron I paid around $10,000! It was
fast and it had mirroring etc as standard but it was still
eye-wateringly expensive... Storage was not cheap and binary
files were common. If you are working in that kind of environment
binary may still be a worthwhile option.

> If you need/want binary storage, pickle has a binary mode. But 
> generally, I am a big believer in sticking to text formats unless 
> you absolutely have to use binary.

In general though I agree with you. The mainframe example above
is the exception not the rule and disk storage is one place I don't
mind XML. For network traffic I hate it and avoid it if possible!
But for most file storage plain txt or XML is far easier to work
with - and can also be compressed if storage is an issue.
And if I need to store a lot of data I use database and let the
vendor (or Opensource programmers) worry about the binary
formatting!!

-- 
Alan Gauld
Author of the Learn to Program web site
http://www.alan-g.me.uk/




More information about the Tutor mailing list