Re: [Tutor] Any Tutor there ? Removing redundant parameters in a models file having include files.

2010-03-03 Thread Karim Liateni


Hello Alan, Steven,

I was narrow minded about this topic and did not see the benefits of 
these multiple Python

implementations. You opened my eyes.

Regards
Karim


Steven D'Aprano wrote:

On Tue, 2 Mar 2010 11:25:44 am Andreas Kostyrka wrote:
  

Furthermore I do not think that most of the "core" community has a
problem with the alternate implementations, as they provide very
useful functions (it helps on the architecture side, because it
limits somewhat what can be done, it helps on the personal side,
because it increases the value of Python skills, ...), ...



The Python development team values alternative implementations, as it 
gives Python the language a much wider user base.


It also allows other people to shoulder some of the development burden. 
For example, people who want Python without the limitations of the C 
call stack can use Stackless Python, instead of ordinary CPython. 
Google is sponsoring a highly optimized version of Python with a JIT 
compiler: Unladen Swallow. It looks likely that Unladen Swallow will 
end up being merged with CPython too, which will be a great benefit.



  


___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Any Tutor there ? Removing redundant parameters in a models file having include files.

2010-03-02 Thread Karim Liateni


Hello,

Thanks a lot for this state of the art of the language, very instructive.
I see now top of the iceberg  ;o)

Karim

Steven D'Aprano wrote:

On Tue, 2 Mar 2010 07:07:57 am Karim Liateni wrote:
  

Thanks for this precision!
I'm using standard python so this is ok!
Why people use proprietary python ?
To have more trouble ? To be different from the rest of community ?



Python is a language, but there can be many different implementations of 
that language, just like there are different C compilers or different 
Javascript engines.


CPython is the version which was made first, it is the most common 
version, but it is not the only one. It is called CPython because it is 
written in C.


Jython is a version of Python written in Java, and it was created by 
people wanting to use Python as a front-end to Java libraries, and to 
take advantage of Java's garbage collector.


IronPython is Microsoft's version of Python written for .Net and Mono.

PyPy is an experimental version of Python written in Python, used by 
people wanting to experiment with Python compilers.


"Python for S60" is a version of Python written for Nokia's S60 devices.

CapPython is an experimental version of Python designed for security.

There are many others, they are all Python, but they have differences.
  


___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Any Tutor there ? Removing redundant parameters in a models file having include files.

2010-03-01 Thread Andreas Kostyrka
> > Why people use proprietary python ?

Well, AFAIK I know, all more or less popular non-Ansi-C implementations of 
Python are free. (Jython is, IronPython too, although I've never checked in 
detail, stackless is, PyPy is too, ...)
> > It's better to spent energy to participate with the core developers to
> > make the common langage evoluate.
> 
> But sometimes you want to go beyond the language, to explore ideas and
> concepts that underlie everything we do in every language. Languages like
>  Lisp and Python make that possible, if not exactly easy!

Actually, having multiple implementations of the language is a huge benefit, 
because that means that we have a language definition apart from the 
implementation. C, C++, Java, C#, Ruby do have alternate implementations. 
Perl, VB, ... do not.

Beside the slightly abstract benefit of splitting definition and 
implementation (which e.g. allows for new and better implementations), most of 
the alternate implementations have, as Alan already pointed out, it's own 
nice.

Jython means that my Python skills carry over into a Java environment.
IronPython means the same for .NET, stackless allows for extreme designs 
without becoming Twisted, Pyrex/Cython (although not Python, but a Python 
look-alike) allows me to interface with C and more important to write code 
that manipulates C data types at the same speed that C does, without the pain 
of all the Python runtime mixing.

Furthermore I do not think that most of the "core" community has a problem 
with the alternate implementations, as they provide very useful functions (it 
helps on the architecture side, because it limits somewhat what can be done, 
it helps on the personal side, because it increases the value of Python 
skills, ...), ...

Andreas
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Any Tutor there ? Removing redundant parameters in a models file having include files.

2010-03-01 Thread ALAN GAULD


> Why people use proprietary python ?

Because it does something normal Python doesn't. For example I often use 
Jython (Python implemented in Java instead of C) because it allows me to 
import Java classes and test them. It also allows me to rapidly build Java 
classes that I can integrate as temporary solutions in Java programs 
until the Java developers get round to writing pure Java versions. (For example 
I can use Python's powerful dynamic collections to create data processing 
classes)

I can also use Jython to interactively experiment with or test Java classes 
using the >>> prompt, to find out how they behave under different conditions.

Others use stackless Python for things like massively parallel processing.

Still others favour Iron Python which is written in .NET so that we can 
use .NET classes and libraries from Python and use Python classes 
within .NET.

> To have more trouble ? To be different from the rest of community ?

No, usually to fit in with another community. Or it may be to experiment 
with different implementation ideas - like many Lisp researchers use Lisp to 
meddle with the interpreter to try out new computing concepts. Its relatively 
easy to do that in Python too. And so the science of computing is advanced.
But at the cost of using non standard implementations. Not everyone 
programs to solve practical problems. :-)

> It's better to spent energy to participate with the core developers to make 
> the
> common langage evoluate.

But sometimes you want to go beyond the language, to explore ideas and 
concepts that underlie everything we do in every language. Languages like Lisp 
and Python make that possible, if not exactly easy!

HTH,

 Alan Gauld
Author of the Learn To Program website
http://www.alan-g.me.uk/



___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Any Tutor there ? Removing redundant parameters in a models file having include files.

2010-03-01 Thread Steven D'Aprano
On Tue, 2 Mar 2010 07:07:57 am Karim Liateni wrote:
> Thanks for this precision!
> I'm using standard python so this is ok!
> Why people use proprietary python ?
> To have more trouble ? To be different from the rest of community ?

Python is a language, but there can be many different implementations of 
that language, just like there are different C compilers or different 
Javascript engines.

CPython is the version which was made first, it is the most common 
version, but it is not the only one. It is called CPython because it is 
written in C.

Jython is a version of Python written in Java, and it was created by 
people wanting to use Python as a front-end to Java libraries, and to 
take advantage of Java's garbage collector.

IronPython is Microsoft's version of Python written for .Net and Mono.

PyPy is an experimental version of Python written in Python, used by 
people wanting to experiment with Python compilers.

"Python for S60" is a version of Python written for Nokia's S60 devices.

CapPython is an experimental version of Python designed for security.

There are many others, they are all Python, but they have differences.




-- 
Steven D'Aprano
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Any Tutor there ? Removing redundant parameters in a models file having include files.

2010-03-01 Thread Karim Liateni


Thanks for this precision!
I'm using standard python so this is ok!
Why people use proprietary python ?
To have more trouble ? To be different from the rest of community ?
Anyway in opensource people do whatever they want but you know
multiple version that was the same before Common C or Lisp it was war 
fields.
It's better to spent energy to participate with the core developers to 
make the

common langage evoluate.

Regards

Karim

Alan Gauld wrote:


"Karim Liateni"  wrote


def getLines(file):
try: lines = open(filename).readlines() ; return lines
except IOError: #handle error


but in the second 'lines = open(filename).readlines()'
I don't hold indirectly a reference to the file? Please, could you 
explain more this point?


Sure, the lines variable holds a reference to the list returned by 
readlines.

There is no variable referring to the file object so immediately after
readlines completes the file will be ready to be closed (at least in
CPython as already pointed out by Lie)

HTH,



___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Any Tutor there ? Removing redundant parameters in a models file having include files.

2010-02-28 Thread Alan Gauld


"Karim Liateni"  wrote


def getLines(file):
  try: lines = open(filename).readlines() ; return lines
  except IOError: #handle error


but in the second 'lines = open(filename).readlines()'
I don't hold indirectly a reference to the file? Please, could you 
explain more this point?


Sure, the lines variable holds a reference to the list returned by 
readlines.

There is no variable referring to the file object so immediately after
readlines completes the file will be ready to be closed (at least in
CPython as already pointed out by Lie)

HTH,

--
Alan Gauld
Author of the Learn to Program web site
http://www.alan-g.me.uk/ 



___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Any Tutor there ? Removing redundant parameters in a models file having include files.

2010-02-28 Thread Karim Liateni

Lie Ryan wrote:

On 03/01/10 02:49, Karim Liateni wrote:
  

Lie Ryan wrote:


On 03/01/10 01:12, Alan Gauld wrote:
  
  

def getLines(file):
  """Get the content of a file in a lines list form."""
  f = open(file, 'r')
  lines = f.readlines()
  f.close()
  return lines
  
  

I'm not sure these functions add enough value to ghave them. I';d
probably just use

try: open(outfile,'w').writelines(lines)
except IOError: #handle error

try: lines = open(filename).readlines()
except IOError: #handle error

The close will be done automatically since you don't hold a reference to
the file



Remember why we have the new with-block? It's precisely because files
will be automagically closed only if we're running on CPython; Python
the language and thus alternative implementations doesn't guarantee
automatic closing. I'd agree with the function having minimal utility
value though:

with open(file) as f:
lines = f.readlines()
# f.close() will be called by the context manager

and if you're just copying to another file:

from contextlib import nested
with nested(open(infile), open(outfile, 'w')) as (fin, fout):
fout.write(fin.read())

or even better, as Alan suggested, using shutil.copyfile().

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

  
  

Thank you Lie but I have a restriction on the python version I must use
v2.2.
This feature is available only on later version 2.5 I believe.



Then you should at the least use the try-finally block, I think that one
has been there since 2.2? If you didn't use try-finally, there is no
guarantee that f.close() would be called if an exception happened in the
middle of reading/writing (e.g. KeyboardInterrupt, or perhaps user
plugging off the thumbdrive, or bit more realistic having a full
harddisk or exceeded some disk quota)

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

  

Thank you Lie.
Yes, in fact I did it all the time during my years of Java development.
In perl I used or open() or die( "msg" ) structure.
I bypassed it because I wanted to construct the blocs very quickly like 
a 'beginner'.
I was excited to make it work as fast as ossible to see if I can program 
something

decent in Python. (gaining confidence? haaa human nature!).

I definitely enjoy python (and not very far in spirit my loving Lisp).
I definitely HATE tcl, java.

Now I will improve quality and robustness.

Thanks a lot!

Karim

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Any Tutor there ? Removing redundant parameters in a models file having include files.

2010-02-28 Thread Lie Ryan
On 03/01/10 02:49, Karim Liateni wrote:
> Lie Ryan wrote:
>> On 03/01/10 01:12, Alan Gauld wrote:
>>   
 def getLines(file):
   """Get the content of a file in a lines list form."""
   f = open(file, 'r')
   lines = f.readlines()
   f.close()
   return lines
   
>>> I'm not sure these functions add enough value to ghave them. I';d
>>> probably just use
>>>
>>> try: open(outfile,'w').writelines(lines)
>>> except IOError: #handle error
>>>
>>> try: lines = open(filename).readlines()
>>> except IOError: #handle error
>>>
>>> The close will be done automatically since you don't hold a reference to
>>> the file
>>> 
>>
>> Remember why we have the new with-block? It's precisely because files
>> will be automagically closed only if we're running on CPython; Python
>> the language and thus alternative implementations doesn't guarantee
>> automatic closing. I'd agree with the function having minimal utility
>> value though:
>>
>> with open(file) as f:
>> lines = f.readlines()
>> # f.close() will be called by the context manager
>>
>> and if you're just copying to another file:
>>
>> from contextlib import nested
>> with nested(open(infile), open(outfile, 'w')) as (fin, fout):
>> fout.write(fin.read())
>>
>> or even better, as Alan suggested, using shutil.copyfile().
>>
>> ___
>> Tutor maillist  -  Tutor@python.org
>> To unsubscribe or change subscription options:
>> http://mail.python.org/mailman/listinfo/tutor
>>
>>   
> Thank you Lie but I have a restriction on the python version I must use
> v2.2.
> This feature is available only on later version 2.5 I believe.

Then you should at the least use the try-finally block, I think that one
has been there since 2.2? If you didn't use try-finally, there is no
guarantee that f.close() would be called if an exception happened in the
middle of reading/writing (e.g. KeyboardInterrupt, or perhaps user
plugging off the thumbdrive, or bit more realistic having a full
harddisk or exceeded some disk quota)

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Any Tutor there ? Removing redundant parameters in a models file having include files.

2010-02-28 Thread Karim Liateni

Lie Ryan wrote:

On 03/01/10 01:12, Alan Gauld wrote:
  

def getLines(file):
  """Get the content of a file in a lines list form."""
  f = open(file, 'r')
  lines = f.readlines()
  f.close()
  return lines
  

I'm not sure these functions add enough value to ghave them. I';d
probably just use

try: open(outfile,'w').writelines(lines)
except IOError: #handle error

try: lines = open(filename).readlines()
except IOError: #handle error

The close will be done automatically since you don't hold a reference to
the file



Remember why we have the new with-block? It's precisely because files
will be automagically closed only if we're running on CPython; Python
the language and thus alternative implementations doesn't guarantee
automatic closing. I'd agree with the function having minimal utility
value though:

with open(file) as f:
lines = f.readlines()
# f.close() will be called by the context manager

and if you're just copying to another file:

from contextlib import nested
with nested(open(infile), open(outfile, 'w')) as (fin, fout):
fout.write(fin.read())

or even better, as Alan suggested, using shutil.copyfile().

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

  
Thank you Lie but I have a restriction on the python version I must use 
v2.2.

This feature is available only on later version 2.5 I believe.

Regards
Karim

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Any Tutor there ? Removing redundant parameters in a models file having include files.

2010-02-28 Thread Karim Liateni


Hello Alan,


Alan Gauld wrote:

"Karim Liateni"  wrote


It concatenates both parameters and include files with the same
parameters definitions. That trigs errors during simulation and
it complains about parameters double definition.


I'd suggest you construct a dictionary based on the param names
You can check before you add ca param if one already exists.
Or alternatively make a Set of param names and check that
for existence before adding a new one.

Yes if I made it with Awk I would definitely use dictionary.
I was focused on list comprehension...First I wanted it to work
even if the method is 'awkward'. Now I will improve it for efficiency.




def copy(infile, outfile):
  """Copy of the content of an input file to an outputfile."""
  fout = open(outfile, 'w')
  fout.writelines(getLines(infile))
  fout.close()


Its probably easier tyo use shutil.copyfile().


Thank you I was certain the function already exist!
But I did not know in which package.




def cat(lines, outfile):
  """Concat the content of a strings list to an outputfile."""
  f = open(outfile, 'w')
  f.writelines(lines)
  f.close()




def getLines(file):
  """Get the content of a file in a lines list form."""
  f = open(file, 'r')
  lines = f.readlines()
  f.close()
  return lines


I'm not sure these functions add enough value to have them. I';d 
probably just use


try: open(outfile,'w').writelines(lines)
except IOError: #handle error

try: lines = open(filename).readlines()
except IOError: #handle error

The close will be done automatically since you don't hold a reference 
to the file




I don't like to repeat code. Is it ok to take your corrections and write 
something like (not exactly the final code but approaching:


def cat(lines, outfile):
 """Concat the content of a strings list to an outputfile."""
 try: open(outfile,'w').writelines(lines)
 except IOError: #handle error

def getLines(file):
 """Get the content of a file in a lines list form."""
 try: lines = open(filename).readlines() ; return lines
 except IOError: #handle error


But In the first form I understand the close is not needed but in the 
second 'lines = open(filename).readlines()'
I don't hold indirectly a reference to the file? Please, could you 
explain more this point?



def isParamExist(file, pattern, parameters):
  """Check if a particular regex pattern parameter is existing in a 
parameters file."""

  lines = getLines(file)
  paramExpressions = [ e for e in lines if pattern.search(e) ]
  matchParam   = [ e for e in paramExpressions if 
pattern.search(e).group(1) in parameters ]

  if matchParam:
return True
  else:
return False


return bool(matchParam) instead of the if/else


One more times thanks! That was I have been searching for.




I am pretty sure that it can be simplify by using a dictionnary with 
the full path file as the key
and the string 'include' nominal line expression as the value to 
construct the final file with filtered include.


I think dictionaries or Sets could improve things


My next goal.




I don't like the part:
 if matchParam:
return True
  else:
return False


See the note above.

HTH,


Alan, I am your obligé. Your remarks are very instructive.

Regards
Karim


___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Any Tutor there ? Removing redundant parameters in a models file having include files.

2010-02-28 Thread Lie Ryan
On 03/01/10 01:12, Alan Gauld wrote:
> 
>> def getLines(file):
>>   """Get the content of a file in a lines list form."""
>>   f = open(file, 'r')
>>   lines = f.readlines()
>>   f.close()
>>   return lines
> 
> I'm not sure these functions add enough value to ghave them. I';d
> probably just use
> 
> try: open(outfile,'w').writelines(lines)
> except IOError: #handle error
> 
> try: lines = open(filename).readlines()
> except IOError: #handle error
> 
> The close will be done automatically since you don't hold a reference to
> the file

Remember why we have the new with-block? It's precisely because files
will be automagically closed only if we're running on CPython; Python
the language and thus alternative implementations doesn't guarantee
automatic closing. I'd agree with the function having minimal utility
value though:

with open(file) as f:
lines = f.readlines()
# f.close() will be called by the context manager

and if you're just copying to another file:

from contextlib import nested
with nested(open(infile), open(outfile, 'w')) as (fin, fout):
fout.write(fin.read())

or even better, as Alan suggested, using shutil.copyfile().

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Any Tutor there ? Removing redundant parameters in a models file having include files.

2010-02-28 Thread Alan Gauld

"Karim Liateni"  wrote


It concatenates both parameters and include files with the same
parameters definitions. That trigs errors during simulation and
it complains about parameters double definition.


I'd suggest you construct a dictionary based on the param names
You can check before you add ca param if one already exists.
Or alternatively make a Set of param names and check that
for existence before adding a new one.


def copy(infile, outfile):
  """Copy of the content of an input file to an outputfile."""
  fout = open(outfile, 'w')
  fout.writelines(getLines(infile))
  fout.close()


Its probably easier tyo use shutil.copyfile()


def cat(lines, outfile):
  """Concat the content of a strings list to an outputfile."""
  f = open(outfile, 'w')
  f.writelines(lines)
  f.close()




def getLines(file):
  """Get the content of a file in a lines list form."""
  f = open(file, 'r')
  lines = f.readlines()
  f.close()
  return lines


I'm not sure these functions add enough value to ghave them. I';d probably 
just use


try: open(outfile,'w').writelines(lines)
except IOError: #handle error

try: lines = open(filename).readlines()
except IOError: #handle error

The close will be done automatically since you don't hold a reference to 
the file



def isParamExist(file, pattern, parameters):
  """Check if a particular regex pattern parameter is existing in a 
parameters file."""

  lines = getLines(file)
  paramExpressions = [ e for e in lines if pattern.search(e) ]
  matchParam   = [ e for e in paramExpressions if 
pattern.search(e).group(1) in parameters ]

  if matchParam:
return True
  else:
return False


return bool(matchParam) instead of the if/else


I am pretty sure that it can be simplify by using a dictionnary with the 
full path file as the key
and the string 'include' nominal line expression as the value to 
construct the final file with filtered include.


I think dictionaries or Sets could improve things


I don't like the part:
 if matchParam:
return True
  else:
return False


See the note above.

HTH,

--
Alan Gauld
Author of the Learn to Program web site
http://www.alan-g.me.uk/ 



___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


[Tutor] Any Tutor there ? Removing redundant parameters in a models file having include files.

2010-02-28 Thread Karim Liateni


Hello Tutor,

Since Friday I get no answers to my first post.
So I re-post it was missed by the numerous arriving email:

This is my first program in python.

I am doing electrical simulation in spectre (spice like).
I have a models file which holds many parameters and
include files of parameters. But in batch mode the automatic
construction (by the simulator) of this file is not correct.
It concatenates both parameters and include files with the same
parameters definitions. That trigs errors during simulation and
it complains about parameters double definition.

The program must removes includes files of already existing parameters 
in the models file.


The file format is shown below:

// --
// Mismatch Variations Selection
// --
parameters param1=0
parameters param2=0
parameters param3=0
parameters param4=0
// --
// Global Flags Definition
// --
parameters gflag_param = 0
// --
// Models Library Files References
// --
include "/project/hvt.scs" section=TT
include "/project/lvt.scs" section=TT
include "/project/svt.scs" section=TT
include "/project/veriloga.scs"  section=typ
include "/project/switch_all.scs" section=no
---

Now my code is shown below:
___

#!/usr/bin/env python
# File: correctCorners K.Liateni 2010-02-25

import re

# ---
#  Functions Declaration
# ---

def copy(infile, outfile):
  """Copy of the content of an input file to an outputfile."""
  fout = open(outfile, 'w')
  fout.writelines(getLines(infile))
  fout.close()

def cat(lines, outfile):
  """Concat the content of a strings list to an outputfile."""
  f = open(outfile, 'w')
  f.writelines(lines)
  f.close()

def getLines(file):
  """Get the content of a file in a lines list form."""
  f = open(file, 'r')
  lines = f.readlines()
  f.close()
  return lines

def isParamExist(file, pattern, parameters):
  """Check if a particular regex pattern parameter is existing in a 
parameters file."""

  lines = getLines(file)
  paramExpressions = [ e for e in lines if pattern.search(e) ]
  matchParam   = [ e for e in paramExpressions if 
pattern.search(e).group(1) in parameters ]

  if matchParam:
return True
  else:
return False

# ---
#  Main Start here
# ---

parRe = '^[ \t]*(parameters[ \t]+[^ \t]+)[ \t]*='
comRe = '^[ \t]*//'

include = re.compile(incRe)
param   = re.compile(parRe)
comment = re.compile(comRe)

lines = getLines("models.scs")

linesWithNoInclude = [ e for e in lines if not include.search(e) ]
linesWithNoParam   = [ e for e in lines if not param.search(e) and not 
comment.search(e) ]


parameters   = [ param.search(e).group(1)   for e in linesWithNoInclude 
if param.search(e) ]

includeFiles = [ include.search(e).group(1) for e in linesWithNoParam ]

includeFilesToWrite = [ e for e in includeFiles if not 
isParamExist(e, param, parameters) ]
includeFilesToWrite = [ e for e in linesWithNoParam if 
include.search(e).group(3) in includeFilesToWrite ]


cat(linesWithNoInclude+includeFilesToWrite, "models_modified.scs")
copy("models_modified.scs", "models.scs"):

# --- end of file --- #

The code works well but I am not fully happy with it. 
includeFilesToWrite is computed in 2 steps.
I am pretty sure that it can be simplify by using a dictionnary with the 
full path file as the key
and the string 'include' nominal line expression as the value to 
construct the final file with filtered include.
I am using python 2.2 so I have not use latest feature I want my code to 
run on old Solaris too (linux user).


I use as much as possible list comprehension following your advices.

I don't like the part:
 if matchParam:
return True
  else:
return False
Is there an easy way to do the same behavior. I am not sure but I saw 
one time something like using
the int value of True (1) and False (0) to select return value in a list 
of 2 elements 'return [False,True](matchParam)'

Is it correct?

Thanks a lot
Karim


___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor