Re: [Tutor] PyMOTW: difflib

2008-04-07 Thread Kent Johnson
Alan Gauld wrote: > "Dick Moores" <[EMAIL PROTECTED]> wrote > >> Could you give a blow-by-blow on the dis.dis()? > > I'll have a go but I've never actually studied Python P-Code, > this is based on my 8080 and 68000 assembler experience! Some hits, some misses. I'll correct to the best of my k

Re: [Tutor] PyMOTW: difflib

2008-04-07 Thread Marc Tompkins
On Mon, Apr 7, 2008 at 4:52 PM, Alan Gauld <[EMAIL PROTECTED]> wrote: > "Dick Moores" <[EMAIL PROTECTED]> wrote > > > Could you give a blow-by-blow on the dis.dis()? > > I'll have a go but I've never actually studied Python P-Code, > this is based on my 8080 and 68000 assembler experience! > ... >

Re: [Tutor] PyMOTW: difflib

2008-04-07 Thread Alan Gauld
"Dick Moores" <[EMAIL PROTECTED]> wrote > Could you give a blow-by-blow on the dis.dis()? I'll have a go but I've never actually studied Python P-Code, this is based on my 8080 and 68000 assembler experience! > In [22]: def f(x): > : if x%2: > : return "odd" > :

Re: [Tutor] PyMOTW: difflib

2008-04-07 Thread Dick Moores
At 02:57 PM 4/7/2008, Dick Moores wrote: This may be pushing it with you, but I found the dis.dis() thing fascinating. Here's a bit more complex function.  def f(x): if x%2: return "odd" else: return "even" Could you give a blow-by-blow on the dis.dis()? ==

Re: [Tutor] PyMOTW: difflib

2008-04-07 Thread Dick Moores
At 12:33 PM 4/7/2008, Kent Johnson wrote: In [13]: import dis In [15]: def foo():     : a = 10 In [16]: dis.dis(foo)    2   0 LOAD_CONST   1 (10)    3 STORE_FAST   0 (a)    6 LOAD_CONST   0 (None)    9 RETURN_

Re: [Tutor] PyMOTW: difflib

2008-04-07 Thread Kent Johnson
Alan Gauld wrote: > "Dick Moores" <[EMAIL PROTECTED]> wrote >> Is a name the same as anything defined? > > Yes pretty much anything that has a name. > > Its worth spending the time reading and playing with > this because its a fundamental concept in Python > and once understood many of the s

Re: [Tutor] PyMOTW: difflib

2008-04-07 Thread Alan Gauld
"Dick Moores" <[EMAIL PROTECTED]> wrote > I'm having trouble with the concept of a name in Python. > > Is a name the same as anything defined? Yes pretty much anything that has a name. It could be a variable, a class, a module, a function, anything that you can refer to or can refer to an ob

Re: [Tutor] PyMOTW: difflib

2008-04-07 Thread Dick Moores
At 12:23 AM 4/7/2008, Alan Gauld wrote: >"Dick Moores" <[EMAIL PROTECTED]> 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 name

Re: [Tutor] PyMOTW: difflib

2008-04-07 Thread Alan Gauld
"Dick Moores" <[EMAIL PROTECTED]> 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

Re: [Tutor] PyMOTW: difflib

2008-04-06 Thread Dick Moores
At 04:39 PM 4/6/2008, Alan Gauld wrote: "Dick Moores" <[EMAIL PROTECTED]> wrote >> > Copied the data into my demo_pymotw-difflib.py, >> > deleted the line "from difflib_data import *", >> > and ran it >> >>I'm curious. Why did you do that? > OK, I put it back in, changing the filename to > demo_

Re: [Tutor] PyMOTW: difflib

2008-04-06 Thread Alan Gauld
"Dick Moores" <[EMAIL PROTECTED]> wrote >> > Copied the data into my demo_pymotw-difflib.py, >> > deleted the line "from difflib_data import *", >> > and ran it >> >>I'm curious. Why did you do that? > OK, I put it back in, changing the filename to > demo_pymotw-difflib_error.py. > See

Re: [Tutor] PyMOTW: difflib

2008-04-06 Thread Dick Moores
At 02:22 PM 4/6/2008, Alan Gauld wrote: >"Dick Moores" <[EMAIL PROTECTED]> wrote > > > I downloaded that compressed file and found difflib_data.py (see it > > at ). Copied the data > > into > > my demo_pymotw-difflib.py, deleted the line "from difflib_dat

Re: [Tutor] PyMOTW: difflib

2008-04-06 Thread Alan Gauld
"Dick Moores" <[EMAIL PROTECTED]> wrote > I downloaded that compressed file and found difflib_data.py (see it > at ). Copied the data > into > my demo_pymotw-difflib.py, deleted the line "from difflib_data > import > *", and ran it I'm curious. Why di

Re: [Tutor] PyMOTW: difflib

2008-04-06 Thread Dick Moores
At 08:24 AM 4/6/2008, Martin Walsh wrote: >Dick Moores wrote: > > See < http://blog.doughellmann.com/2007/10/pymotw-difflib.html> > > > > And my try with the Differ example, > > , which also shows the error, > > > > "E:\Python25\pythonw.exe" -u "E:\PythonW

Re: [Tutor] PyMOTW: difflib

2008-04-06 Thread Martin Walsh
Dick Moores wrote: > See < http://blog.doughellmann.com/2007/10/pymotw-difflib.html> > > And my try with the Differ example, < > http://py77.python.pastebin.com/f41ec1ae8>, which also shows the error, > > "E:\Python25\pythonw.exe" -u "E:\PythonWork\demo_pymotw-difflib.py" > Traceback (most recent

[Tutor] PyMOTW: difflib

2008-04-05 Thread Dick Moores
See < http://blog.doughellmann.com/2007/10/pymotw-difflib.html> And my try with the Differ example, < http://py77.python.pastebin.com/f41ec1ae8>, which also shows the error, "E:\Python25\pythonw.exe" -u "E:\PythonWork\demo_pymotw-difflib.py" Traceback (most recent call last):  File "E:\PythonWor