Gentoo Archives: gentoo-dev

From: George Shapovalov <george@g.o>
To: gentoo-dev@g.o
Subject: Re: [gentoo-dev] Portage programming question
Date: Sun, 30 Mar 2003 19:52:57
Message-Id: 200303301153.55960.george@gentoo.org
In Reply to: Re: [gentoo-dev] Portage programming question by "Robin H. Johnson"
1 Ho Robin.
2
3 On Sunday 30 March 2003 02:47, Robin H. Johnson wrote:
4 [skipped]
5 > Python's implementation of a MAP (dictionary) implemented via hash
6 > tables, but I can't find anything on tweaking the load factor and
7 > initial capacity, which makes a significent difference on data sets of
8 > large but known sizes.
9 Then it looks like you might want to look here:
10 http://www.python.org/doc/current/lib/module-array.html
11 This is a more lightwieght implementation and provides a buffer interface.
12
13 There are also numerical python modules:
14 http://numpy.sourceforge.net/numdoc/HTML/numdoc.htm
15
16 However if you need to do large numerical computations and you worry about
17 efficiency, then I would say/agree that python is probably not the right
18 choice. I would pick C++/Pascal for the task (just as you intended). The code
19 can be hooked back to python without too much trouble (use swig for example).
20 So that you may implement crytical functions in say C++ and then call them
21 from your "main" python code. It is also possible to hook python code to C++,
22 the other way around. As I remember swig can help in that too.. (help mostly
23 means automating significant parts of the process).
24
25
26 > For these structures, various iterators are required as well, as this is
27 > the best way to traverse the data. Functional programming methods to
28 > apply to the data is also required, such as (Python provides these first
29 > three) filter, map, reduce, (Python doesn't seem to have these last
30 > three) set union, set difference, set intersection.
31 Yes, this is true for 2.2 series. Sets are not completely supported as you
32 just mentioned, only basic functionality.
33
34 > It seems Python did at one stage consider adding SETS:
35 > http://www.python.org/peps/pep-0218.html
36 > But I can't make much sense of the outcome.
37 Well, its being added rather than was considering at one stage. I hope that
38 PEP paper makes more sense this way :).
39 From what I can see this functionality is already (at least partially) in
40 python-2.3, which is in alpha stage right now. So chances are quite good,
41 that this will appear in 2.3 when it's released (probably as experimental
42 feature as is common, though this may be done as a separate module, in which
43 case it will just be awailable).
44
45
46 > It seems I would have to implement BIMAP myself, since there isn't one
47 [skip]
48 > BIMAP is the main structure that I would be using, but SET and MAP also
49 > to a slightly lesser degree. I want to create a BIMAP containing the
50 > relative paths to each ebuild as one key, and the IUSE data from that
51 > ebuild as the other key.
52 Oh, I see. Yea, I don't remember seing bimap-type structures in built-in
53 types, though I would not consider myself a python guru in any way..
54 Just trying to help here the best way I can :).
55
56 You might want to try one of python mailing lists:
57 http://www.python.org/psa/MailingLists.html
58 There is one devoted to sets and another to numerical stuff as well as some
59 newsgroups. I think there is an irc channel on irc.freenode.net as well
60 (populated at around 100+ when I tried it some time ago), I think that was
61 #python.
62 Hope this makes any sense..
63
64 George
65
66
67
68 --
69 gentoo-dev@g.o mailing list

Replies

Subject Author
[gentoo-dev] Probleme merging media-video/avifile Thomas Mangin <thomas.mangin@××××.fr>