[petsc-dev] breakage with python2.2
Barry Smith
bsmith at mcs.anl.gov
Tue Feb 2 21:33:26 CST 2010
Previous: 6 PEP 278: Universal Up: What's New in Python Next: 8 PEP
282: The
7 PEP 279: enumerate()
A new built-in function, enumerate(), will make certain loops a bit
clearer. enumerate(thing), where thing is either an iterator or a
sequence, returns a iterator that will return (0, thing[0]), (1,
thing[1]), (2, thing[2]), and so forth.
A common idiom to change every element of a list looks like this:
for i in range(len(L)): item = L[i] # ... compute some result based on
item ... L[i] = result
This can be rewritten using enumerate() as:
for i, item in enumerate(L): # ... compute some result based on
item ... L[i] = result
On Feb 2, 2010, at 7:19 PM, Satish Balay wrote:
> Thanks - thats fixes it. The next issue is for Jed.
>
> *********************************************************************************
> global name 'enumerate' is not defined File "config/configure.py",
> line 229, in petsc_configure
> framework.configure(out = sys.stdout)
> File "/home/balay/tmp/petsc-dev/config/BuildSystem/config/
> framework.py", line 907, in configure
> child.configure()
> File "/home/balay/tmp/petsc-dev/config/PETSc/utilities/
> cacheDetails.py", line 102, in configure
> self.executeTest(self.configureCacheDetails)
> File "/home/balay/tmp/petsc-dev/config/BuildSystem/config/base.py",
> line 97, in executeTest
> ret = apply(test, args,kargs)
> File "/home/balay/tmp/petsc-dev/config/PETSc/utilities/
> cacheDetails.py", line 76, in configureCacheDetails
> (fname, source) = self.getconfFunction(a)
> File "/home/balay/tmp/petsc-dev/config/PETSc/utilities/
> cacheDetails.py", line 65, in getconfFunction
> for (m,d) in enumerate(methods):
> *********************************************************************************
>
> Also the current code looks buggy. self.methods[self.method=0] will
> never get used?
>
> Satish
>
> On Tue, 2 Feb 2010, Matthew Knepley wrote:
>
>> On Tue, Feb 2, 2010 at 5:56 PM, Satish Balay <balay at mcs.anl.gov>
>> wrote:
>>
>>> Matt,
>>>
>>> [petsc configure is supporsed to be compatible with python 2.2 and
>>> higher].
>>> But I get the following error [apart from missing
>>> 'os.path.pathsep'] with
>>> python2.2
>>>
>>> Any idea how to fix this? [
>>>
>>
>> Pushed the fix.
>>
>> Matt
>>
>>
>>> thanks,
>>> Satish
>>> -------
>>>
>>> asterix:/home/balay/tmp/petsc-dev>!py
>>> python2.2 config/configure.py --with-mpi=0
>>>
>>> =
>>> =
>>> =
>>> =
>>> =
>>> =
>>> =
>>> =
>>> =
>>> =
>>> =
>>> =
>>> =
>>> ====================================================================
>>> Configuring PETSc to compile on your system
>>>
>>> =
>>> =
>>> =
>>> =
>>> =
>>> =
>>> =
>>> =
>>> =
>>> =
>>> =
>>> =
>>> =
>>> ====================================================================
>>> /home/balay/tmp/petsc-dev/config/PETSc/packages/Matlab.py:21:
>>> Warning:
>>> 'yield' will become a reserved keyword in the future
>>>
>>> *********************************************************************************
>>> CONFIGURATION CRASH (Please send configure.log to
>>> petsc-maint at mcs.anl.gov)
>>>
>>> *********************************************************************************
>>>
>>> invalid syntax (Matlab.py, line 21)
>>> File "config/configure.py", line 226, in petsc_configure
>>> framework =
>>> config.framework.Framework(['--configModules=PETSc.Configure','--
>>> optionsModule=PETSc.compilerOptions']+sys.argv[1:],
>>> loadArgDB = 0)
>>> File "/home/balay/tmp/petsc-dev/config/BuildSystem/config/
>>> framework.py",
>>> line 104, in __init__
>>> self.createChildren()
>>> File "/home/balay/tmp/petsc-dev/config/BuildSystem/config/
>>> framework.py",
>>> line 330, in createChildren
>>> self.getChild(moduleName)
>>> File "/home/balay/tmp/petsc-dev/config/BuildSystem/config/
>>> framework.py",
>>> line 315, in getChild
>>> config.setupDependencies(self)
>>> File "/home/balay/tmp/petsc-dev/config/PETSc/Configure.py", line
>>> 45, in
>>> setupDependencies
>>> utilityObj =
>>> self.framework.require('PETSc.'+d+'.'+utilityName, self)
>>> File "/home/balay/tmp/petsc-dev/config/BuildSystem/config/
>>> framework.py",
>>> line 335, in require
>>> config = self.getChild(moduleName, keywordArgs)
>>> File "/home/balay/tmp/petsc-dev/config/BuildSystem/config/
>>> framework.py",
>>> line 288, in getChild
>>> type = __import__(moduleName, globals(), locals(),
>>> ['Configure']).Configure
>>> asterix:/home/balay/tmp/petsc-dev>cat configure.log
>>> Pushing language C
>>> Popping language C
>>> Pushing language Cxx
>>> Popping language Cxx
>>> Pushing language FC
>>> Popping language FC
>>> asterix:/home/balay/tmp/petsc-dev>
>>>
>>>
>>>
>>
>>
>>
>
More information about the petsc-dev
mailing list