You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Expose and document the junk and popular sets as attributes of the SequenceMatcher object.
self.junk=junkself.popular=popular
Deprecate the then unneeded and undocumented isbjunk and isbpopular functions, currently defined as
self.isbjunk = junk.__contains__
self.isbpopular = popular.__contains__
(and slightly modify the matcher function that localizes and uses one of the above).
Question, (how) do we document deprecation/removal of undocumented function?
In discussions that included Tim Peters, the idea of exposing the tuning parameters of the heuristic was discussed. Now that the heuristic can be turned off, I think this is YAGNI until someone specifically requests it.
Here is a pretty minimal patch to expose bjunk and bpopular as attributes and document them along with b2j, which is already exposed but not documented.
I suppose the proposed paragraph could be formatted as a list, perhaps after
":class:`SequenceMatcher` objects have the following methods:"
with 'methods' expanded to 'attributes and methods'. But I do not know how to do that and personally prefer what I wrote.
However, Georg, I am adding you as nosy so you can comment on the doc addition *before* I commit this tomorrow, to get it in the beta.
Still to do: improve the doctests, including those added as part of bpo-2986, to use the exposed sets (they are already implicitly tested by the existing tests); deprecate the two obsolete function attributes, as discussed on pydev.
The docstrings and code comments might stand revision, and there is an XXX todo in the doc yet.
Deprecated isbjunk and isbpopular methods, ran doc and unit tests, and committed as r87000. Still need to add 'gone in 3.3 test' when revise unittests.
Added tweak to .__chain_b to avoid creating list of b2j.keys and .items be deleting from b2j in separate loop after creating sets. Test with timeit suggests time about same with 1% deletion. r87276
Activity
terryjreedy commentedon Nov 25, 2010
Expose and document the junk and popular sets as attributes of the SequenceMatcher object.
Deprecate the then unneeded and undocumented isbjunk and isbpopular functions, currently defined as
self.isbjunk = junk.__contains__
self.isbpopular = popular.__contains__
(and slightly modify the matcher function that localizes and uses one of the above).
Question, (how) do we document deprecation/removal of undocumented function?
In discussions that included Tim Peters, the idea of exposing the tuning parameters of the heuristic was discussed. Now that the heuristic can be turned off, I think this is YAGNI until someone specifically requests it.
terryjreedy commentedon Dec 3, 2010
Here is a pretty minimal patch to expose bjunk and bpopular as attributes and document them along with b2j, which is already exposed but not documented.
I suppose the proposed paragraph could be formatted as a list, perhaps after
":class:`SequenceMatcher` objects have the following methods:"
with 'methods' expanded to 'attributes and methods'. But I do not know how to do that and personally prefer what I wrote.
However, Georg, I am adding you as nosy so you can comment on the doc addition *before* I commit this tomorrow, to get it in the beta.
Still to do: improve the doctests, including those added as part of bpo-2986, to use the exposed sets (they are already implicitly tested by the existing tests); deprecate the two obsolete function attributes, as discussed on pydev.
The docstrings and code comments might stand revision, and there is an XXX todo in the doc yet.
birkenfeld commentedon Dec 3, 2010
Don't worry about doc additions too much; all doc changes can be considered bug fixes.
In this patch, it appears that two of the three attributes are new? They should get a versionadded.
terryjreedy commentedon Dec 3, 2010
Added version-added and committed. r86983
terryjreedy commentedon Dec 3, 2010
Deprecated isbjunk and isbpopular methods, ran doc and unit tests, and committed as r87000. Still need to add 'gone in 3.3 test' when revise unittests.
terryjreedy commentedon Dec 3, 2010
News entry for both commits: r87001
elibendersky commentedon Dec 4, 2010
Terry,
Attaching a patch with the following:
terryjreedy commentedon Dec 15, 2010
Added tweak to .__chain_b to avoid creating list of b2j.keys and .items be deleting from b2j in separate loop after creating sets. Test with timeit suggests time about same with 1% deletion. r87276