From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21060 invoked by uid 1002); 30 Mar 2003 19:52:57 -0000 Mailing-List: contact gentoo-dev-help@gentoo.org; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-dev@gentoo.org Received: (qmail 24449 invoked from network); 30 Mar 2003 19:52:56 -0000 From: George Shapovalov Organization: Gentoo Linux To: gentoo-dev@gentoo.org Date: Sun, 30 Mar 2003 11:53:55 -0800 User-Agent: KMail/1.5.1 References: <20030330063505.GA19969@cherenkov.orbis-terrarum.net> <200303300113.24841.george@gentoo.org> <20030330104705.GA20613@cherenkov.orbis-terrarum.net> In-Reply-To: <20030330104705.GA20613@cherenkov.orbis-terrarum.net> MIME-Version: 1.0 Content-Type: text/plain; charset="koi8-r" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Message-Id: <200303301153.55960.george@gentoo.org> X-Spam-Status: No, hits=-4.0 required=5.0 tests=CARRIAGE_RETURNS,IN_REP_TO,MIME_LONG_LINE_QP,NOSPAM_INC, QUOTED_EMAIL_TEXT,REFERENCES,SPAM_PHRASE_03_05,USER_AGENT, USER_AGENT_KMAIL version=2.43 X-Spam-Level: Subject: Re: [gentoo-dev] Portage programming question X-Archives-Salt: 9053d52d-f79f-4c1f-8b2c-e7b4ef1be15c X-Archives-Hash: 4a80e44bddfcd779e3e2057c08882699 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= =20 efficiency, then I would say/agree that python is probably not the right=20 choice. I would pick C++/Pascal for the task (just as you intended). The co= de=20 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= =20 from your "main" python code. It is also possible to hook python code to C+= +,=20 the other way around. As I remember swig can help in that too.. (help mostl= y=20 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= =20 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= =20 PEP paper makes more sense this way :).=20 =46rom what I can see this functionality is already (at least partially) in= =20 python-2.3, which is in alpha stage right now. So chances are quite good,=20 that this will appear in 2.3 when it's released (probably as experimental=20 feature as is common, though this may be done as a separate module, in whic= h=20 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=20 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= =20 newsgroups. I think there is an irc channel on irc.freenode.net as well=20 (populated at around 100+ when I tried it some time ago), I think that was= =20 #python. Hope this makes any sense.. George -- gentoo-dev@gentoo.org mailing list