About using Python's 'Set' in BuildSystem

Lisandro Dalcin dalcinl at gmail.com
Tue Jul 14 13:46:00 CDT 2009


While working on the patch for updating BuildSystem to Python 2.6, I
notices something that could be potentially problematic

Currently, BuildSystem uses 'set' implementations with different semantics

1) in almost all files it uses the Python's stdlib module 'sets', or
'config.setBackports' implementation if the first is not available. In
either case, the 'Set' implementation is hash-table based, i.e., the
container does not have any notion of "ordering", and insertion order
is indeed not preserved.

2) In 'config/compile/C.py' it uses 'config.setsOrdered'. This
implementation "remembers" insertion order...


As preserving insertion order is a rather important behavior for the
usage of these 'Set' instances (thing of a set of library names, even
a set of library or include directories), I'm starting to think that
in almost all places we should use the 'Set' implementation on
'config.setsOrdered'.

What do you think?


-- 
Lisandro Dalcín
---------------
Centro Internacional de Métodos Computacionales en Ingeniería (CIMEC)
Instituto de Desarrollo Tecnológico para la Industria Química (INTEC)
Consejo Nacional de Investigaciones Científicas y Técnicas (CONICET)
PTLC - Güemes 3450, (3000) Santa Fe, Argentina
Tel/Fax: +54-(0)342-451.1594



More information about the petsc-dev mailing list