On Wed, Aug 22, 2018 at 06:50:29PM +0000, Dan Sommers wrote:
> On Thu, 23 Aug 2018 03:44:07 +1000, Steven D'Aprano wrote:
> 
> > On Wed, Aug 22, 2018 at 12:11:40PM -0500, Abe Dillon wrote:
> 
> > difflib tests include this call:
> >
> > sm = difflib.SequenceMatcher(isjunk=lambda x: x == ' ', ...)
[...]

> When you talk about intent, I think about use cases.  In the difflib
> code I quoted above, is the intent to define a function, or to
> instantiate a SequenceMatcher?  Well, no, it's probably to compute some
> sort of difference.  Instatiating a SequenceMatcher and defining isjunk
> are details.
> 
> So you're both wrong.  :-P
> 
> Or you're both right.  :-/

In this case, "intent" could refer to (for example):

Should we accuse Fred Bloggs of plagarism or not?
+- decide whether two documents came from the same source;
  +- decide whether the diff between two text strings falls 
     within some threshold;
     +- initiate and use a SequenceMatcher object;
        +- provide an isjunk predicate function;
           +- implement a specific predicate function.


Because we are talking about lambda syntax specifically, I didn't think 
the higher hierachies of intent were relevant, so I didn't mention them. 
I thought we could focus on the two relevant to the syntax we're 
discussing:

Provide an isjunk predicate function;
+- implement a specific predicate function.

and take the higher levels as given. Given those two levels, "Provide a 
predicate function" is at a higher level than the implementation of that 
predicate function.

I'm sorry if that wasn't clear.



-- 
Steve
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to