[Tutor] PyMOTW: difflib

Alan Gauld alan.gauld at btinternet.com
Mon Apr 7 09:23:46 CEST 2008


"Dick Moores" <rdm at rcblue.com> wrote in message 

> Even if there weren't a path problem, my understanding is that   
> from difflib_data import *   would only import the functions in 
> difflib_data.py; There are none.  

import imports names. Any names, not just functions.
After all, function names are just names like any other

sqr = lambda x: x*x

is exactly the same as

def sqr(x): return x*x

In both cases import will give you access to sqr as a name

So in your case the names text1, text2, text1_lines and 
text2_lines will all be made available within your script.

HTH,


-- 
Alan Gauld
Author of the Learn to Program web site
http://www.freenetpages.co.uk/hp/alan.gauld



More information about the Tutor mailing list