> What do you want?
Basically, I have lots of python scripts
that work with and process files/logs...etc.
However, these are sometimes huge files and
need huge data structures.
A simple example (in python) :
file_input = open('biglog.txt','r')
d = {}
for line in file_input.readlines():
x = line.split('\t')
if not d.has_key(x[0]):
d[x[0]] = (x[1], x[2], x[3])
file_input.close()
pretty_print_stuff_with_d(d)
Lots of my file/log processing examples
is along these lines. Sometimes it is
many lines. Sometimes it is multiple
dicts (or dict of dicts) and more
complicated number-crunching.
Hence, my need for speed.
[Actually speaking, I would be very happy
with a *fast* restricted python for these
kind of purposes]
I have also tried using psyco (which is
really cool and helps with the number,
algorithms sections of the code).
A slight digression :
The other interesting thing I note is this.
When I am reading programming languages
books, online docs for languages like
python, perl, the above is a typical
example I would see in the first 10 pages.
When I am reading a book (or docs) on ocaml,
erlang or scheme, I find that the whole
print example itself coming up like in
the 10th chapter. And sometimes, the whole
file open/parse/close example is skipped.
[For example, in the "Essentials of Programming
Languages" book which uses Scheme, the first
time an input/output example is shown is in
page 116]. :)
Don't get me wrong, I love that book.
IMHO, a quick file example program is super
quick way to code and try out in a new language.
My guess is that a lots of perl coders got into
perl this way (I did too, once upon a time).
Thanks a lot,
Krishna.
skaller wrote:
> On Mon, 2007-07-09 at 14:59 -0700, Krishna Srinivasan wrote:
>
>> And I cannot find how to open, read, write files.
>> Can someone please point me to that ?
>
> This is a mess at the moment.
>
> There are three basic kinds of files:
>
> * unix fd or windows handles
> * C FILE*
> * C++ iostreams
>
> and on top of that we have built Felix level wrappers,
> and on top of that there is a half completed typeclass
> based stream abstraction.
>
> So actually we have not got this right yet.
>
> The last version of Felix added typeclasses, and it
> changed the whole way we approached making libraries:
> we start to use typeclasses instead of open overloading,
> but typeclasses make you think much harder about your
> abstractions, which is good. But the conversion isn't
> finished because we're still confused.. this isn't
> a Felix language issue but a library issue.
>
> It needs to be driven by what users expect tempered
> with a nice theoretical model .. so ..
>
> What do you want?
>
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Felix-language mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/felix-language