[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gentoo-dev
Subject:    Re: [gentoo-dev] Portage programming question
From:       George Shapovalov <george () gentoo ! org>
Date:       2003-03-30 19:53:55
[Download RAW message or body]

Ho Robin.

On Sunday 30 March 2003 02:47, Robin H. Johnson wrote:
[skipped]
> Python's implementation of a MAP (dictionary) implemented via hash
> tables, but I can't find anything on tweaking the load factor and
> initial capacity, which makes a significent difference on data sets of
> large but known sizes.
Then it looks like you might want to look here:
http://www.python.org/doc/current/lib/module-array.html
This is a more lightwieght implementation and provides a buffer interface.

There are also numerical python modules:
http://numpy.sourceforge.net/numdoc/HTML/numdoc.htm

However if you need to do large numerical computations and you worry about 
efficiency, then I would say/agree that python is probably not the right 
choice. I would pick C++/Pascal for the task (just as you intended). The code 
can be hooked back to python without too much trouble (use swig for example).
So that you may implement crytical functions in say C++ and then call them 
from your "main" python code. It is also possible to hook python code to C++, 
the other way around. As I remember swig can help in that too.. (help mostly 
means automating significant parts of the process).


> For these structures, various iterators are required as well, as this is
> the best way to traverse the data. Functional programming methods to
> apply to the data is also required, such as (Python provides these first
> three) filter, map, reduce, (Python doesn't seem to have these last
> three) set union, set difference, set intersection.
Yes, this is true for 2.2 series. Sets are not completely supported as you 
just mentioned, only basic functionality.

> It seems Python did at one stage consider adding SETS:
> http://www.python.org/peps/pep-0218.html
> But I can't make much sense of the outcome.
Well, its being added rather than was considering at one stage. I hope that 
PEP paper makes more sense this way :). 
From what I can see this functionality is already (at least partially) in 
python-2.3, which is in alpha stage right now. So chances are quite good, 
that this will appear in 2.3 when it's released (probably as experimental 
feature as is common, though this may be done as a separate module, in which 
case it will just be awailable).


> It seems I would have to implement BIMAP myself, since there isn't one
[skip]
> BIMAP is the main structure that I would be using, but SET and MAP also
> to a slightly lesser degree. I want to create a BIMAP containing the
> relative paths to each ebuild as one key, and the IUSE data from that
> ebuild as the other key.
Oh, I see. Yea, I don't remember seing bimap-type structures in built-in 
types, though I would not consider myself a python guru in any way..
Just trying to help here the best way I can :).

You might want to try one of python mailing lists:
http://www.python.org/psa/MailingLists.html
There is one devoted to sets and another to numerical stuff as well as some 
newsgroups. I think there is an irc channel on irc.freenode.net as well 
(populated at around 100+ when I tried it some time ago), I think that was 
#python.
Hope this makes any sense..

George



--
gentoo-dev@gentoo.org mailing list


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic