[issue22823] Use set literals instead of creating a set from a list

2014-12-13 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: That's all I think. Distutils is too conservative for such changes. -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker ___

[issue22823] Use set literals instead of creating a set from a list

2014-12-13 Thread Roundup Robot
Roundup Robot added the comment: New changeset c3f960cff3e6 by Serhiy Storchaka in branch '3.4': Issue #22823: Use set literals in lib2to3. https://hg.python.org/cpython/rev/c3f960cff3e6 New changeset d3e43f7ecca8 by Serhiy Storchaka in branch 'default': Issue #22823: Use set literals in lib2to3

[issue22823] Use set literals instead of creating a set from a list

2014-12-13 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : -- assignee: benjamin.peterson -> serhiy.storchaka ___ Python tracker ___ ___ Python-bugs-list mailing l

[issue22823] Use set literals instead of creating a set from a list

2014-12-12 Thread Benjamin Peterson
Benjamin Peterson added the comment: 2to3 patch lgtm. Please apply to 3.4, too, though. -- ___ Python tracker ___ ___ Python-bugs-list

[issue22823] Use set literals instead of creating a set from a list

2014-12-11 Thread Roundup Robot
Roundup Robot added the comment: New changeset 7c2811521261 by Victor Stinner in branch 'default': Issue #22823: Fix typo in unittest/mock.py https://hg.python.org/cpython/rev/7c2811521261 -- ___ Python tracker ___

[issue22823] Use set literals instead of creating a set from a list

2014-12-11 Thread Roundup Robot
Roundup Robot added the comment: New changeset ce66b65ad8d6 by Terry Jan Reedy in branch '2.7': Issue 22823: Use set literal in idlelib. https://hg.python.org/cpython/rev/ce66b65ad8d6 New changeset daec40891d43 by Terry Jan Reedy in branch '3.4': Issue 22823: Use set literal in idlelib. https://

[issue22823] Use set literals instead of creating a set from a list

2014-12-11 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Tests are intentionally omitted, Lib/stringrep.py is very special case (it's code is generated and outdated, see issue15239), idlelib is deferred by Terry. And there is yet one one-line change to Lib/distutils/msvc9compiler.py in set_literal_3.patch. --

[issue22823] Use set literals instead of creating a set from a list

2014-12-11 Thread STINNER Victor
STINNER Victor added the comment: > Here is a patch for lib2to3. In Python 3.5, I still found some "set([" and "frozenset([" in Lib/lib2to3, Lib/test/, Lib/stringrep.py, Lib/unittest/test/ and Lib/idlelib/CodeContext.py if someone is motived to patch them. (Ok, Serhiy wrote a patch for lib2to3

[issue22823] Use set literals instead of creating a set from a list

2014-12-11 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Docs changes were applied to 3.4 too. Here is a patch for lib2to3. -- assignee: serhiy.storchaka -> benjamin.peterson nosy: +benjamin.peterson stage: commit review -> patch review Added file: http://bugs.python.org/file37413/set_literal_2to3.patch __

[issue22823] Use set literals instead of creating a set from a list

2014-12-11 Thread Roundup Robot
Roundup Robot added the comment: New changeset b6e6a86a92a7 by Serhiy Storchaka in branch 'default': Issue #22823: Use set literals instead of creating a set from a list. https://hg.python.org/cpython/rev/b6e6a86a92a7 New changeset 86a694781bee by Serhiy Storchaka in branch '3.4': Issue #22823:

[issue22823] Use set literals instead of creating a set from a list

2014-12-10 Thread Raymond Hettinger
Changes by Raymond Hettinger : -- assignee: michael.foord -> serhiy.storchaka ___ Python tracker ___ ___ Python-bugs-list mailing list

[issue22823] Use set literals instead of creating a set from a list

2014-12-10 Thread Michael Foord
Michael Foord added the comment: Patch looks good to me. -- ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: htt

[issue22823] Use set literals instead of creating a set from a list

2014-12-09 Thread Berker Peksag
Berker Peksag added the comment: Updated Serhiy's patch. -- nosy: +berker.peksag Added file: http://bugs.python.org/file37404/issue22823-mock.diff ___ Python tracker ___

[issue22823] Use set literals instead of creating a set from a list

2014-11-15 Thread Terry J. Reedy
Terry J. Reedy added the comment: OK, someone can copy and paste this. non_defaults = { '__get__', '__set__', '__delete__', '__reversed__', '__missing__', '__reduce__', '__reduce_ex'__, '__getinitargs__', '__getnewargs__', '__getstate__', '__setstate__', '__getformat__', '__setfor

[issue22823] Use set literals instead of creating a set from a list

2014-11-15 Thread Raymond Hettinger
Raymond Hettinger added the comment: IMO, the _non_defaults set comprehension in mock.py ought to be replaced with a set of internable string constants. -- ___ Python tracker __

[issue22823] Use set literals instead of creating a set from a list

2014-11-15 Thread Terry J. Reedy
Terry J. Reedy added the comment: mock patch LGTM -- stage: patch review -> commit review ___ Python tracker ___ ___ Python-bugs-list

[issue22823] Use set literals instead of creating a set from a list

2014-11-15 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: > Can you also make a separate mock patch and assign it to Michael Foord for > review? Here is a patch. It also replaces constructing sets from generators with set comprehensions. -- assignee: serhiy.storchaka -> michael.foord nosy: +michael.foord s

[issue22823] Use set literals instead of creating a set from a list

2014-11-15 Thread Roundup Robot
Roundup Robot added the comment: New changeset f4e75efdc7f1 by Serhiy Storchaka in branch 'default': Issue #22823: Use set literals instead of creating a set from a tuple. https://hg.python.org/cpython/rev/f4e75efdc7f1 -- ___ Python tracker

[issue22823] Use set literals instead of creating a set from a list

2014-11-13 Thread Raymond Hettinger
Raymond Hettinger added the comment: Serhiy, go ahead and apply the clinic.py patch. Can you also make a separate mock patch and assign it to Michael Foord for review? -- assignee: larry -> serhiy.storchaka ___ Python tracker

[issue22823] Use set literals instead of creating a set from a list

2014-11-11 Thread Larry Hastings
Larry Hastings added the comment: The patch is totally fine. I wonder why it was like that in the first place! -- ___ Python tracker ___

[issue22823] Use set literals instead of creating a set from a list

2014-11-10 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Here is updated patch for clinic only. -- keywords: +patch Added file: http://bugs.python.org/file37174/set_literal_clinic.patch ___ Python tracker __

[issue22823] Use set literals instead of creating a set from a list

2014-11-10 Thread Larry Hastings
Larry Hastings added the comment: Serhiy: set_literal_2.patch doesn't apply cleanly, so I don't get a "review" link. And apparently Raymond checked in some other changes separately. Could you redo your patch so it has the Clinic changes, and ensure I get a "review" link? -- ___

[issue22823] Use set literals instead of creating a set from a list

2014-11-09 Thread Raymond Hettinger
Raymond Hettinger added the comment: Larry, would you care to apply or approve Serhiy's updates to clinic.py? -- assignee: rhettinger -> larry nosy: +larry ___ Python tracker ___

[issue22823] Use set literals instead of creating a set from a list

2014-11-09 Thread Roundup Robot
Roundup Robot added the comment: New changeset 4480506137ed by Raymond Hettinger in branch 'default': Issue #22823: Use set literals instead of creating a set from a list https://hg.python.org/cpython/rev/4480506137ed -- nosy: +python-dev ___ Python t

[issue22823] Use set literals instead of creating a set from a list

2014-11-09 Thread Raymond Hettinger
Raymond Hettinger added the comment: If there are no objections, I would like to apply my two patches (plus the one-line asdl.py change) and leave the rest to the discretion the module maintainers (mock, code context, clinic, and 2-to-3). -- ___ Pyt

[issue22823] Use set literals instead of creating a set from a list

2014-11-09 Thread Raymond Hettinger
Raymond Hettinger added the comment: Hmm, didn't look at those parts of the tree. I'll change the one-line in Parser and leave the little atrocities in clinic.py for Larry to fix :-) Reprlib was skipped intentionally. There is a separate tracker item for it. http://bugs.python.org/issue2282

[issue22823] Use set literals instead of creating a set from a list

2014-11-09 Thread Terry J. Reedy
Terry J. Reedy added the comment: Serhiy, as I said before, please omit idlelib/CodeContext. You both skipped reprlib.py. Should it be changed to produce the standard repr() result? The existing lines: F:\Python\dev\35\lib\reprlib.py: 91: return self._repr_iterable(x, level, 'set([',

[issue22823] Use set literals instead of creating a set from a list

2014-11-09 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: You have missed Parser/asdl.py and Tools/clinic/clinic.py. -- Added file: http://bugs.python.org/file37161/set_literal_2.patch ___ Python tracker

[issue22823] Use set literals instead of creating a set from a list

2014-11-09 Thread Raymond Hettinger
Raymond Hettinger added the comment: Okay, I missed the frozenset(( examples in my search. There are all in one-time set-up code. Attaching a patch for them as well. -- Added file: http://bugs.python.org/file37160/more_set_literals.patch ___ Python

[issue22823] Use set literals instead of creating a set from a list

2014-11-09 Thread Raymond Hettinger
Raymond Hettinger added the comment: Attaching a patch. Doesn't change tests for the reasons mentioned above. Leaves idle, 2-to-3, and mocking for their respective module maintainers to deal with holistically (as part of their routine maintenance). -- keywords: +patch Added file: htt

[issue22823] Use set literals instead of creating a set from a list

2014-11-09 Thread Terry J. Reedy
Terry J. Reedy added the comment: Serhiy, about your 'huge patch' to modernize code: I am more positive than some because: 1) To me, a one-time gentile change is not 'churning'. 2) As we link to many, most, or even all python-coded stdlib modules (I think there is a proposal for 'all'), there

[issue22823] Use set literals instead of creating a set from a list

2014-11-09 Thread Raymond Hettinger
Raymond Hettinger added the comment: > The same timing for frozenset((1,2,3)) (.29) is faster than the best > timing for frozenset({1,2,3}), (.36), I don't see the tuple form used anywhere in the code. The timing is a bit quicker for the tuple form because the peephole optimizer constant folds

[issue22823] Use set literals instead of creating a set from a list

2014-11-09 Thread Terry J. Reedy
Terry J. Reedy added the comment: My timing for set((1,2,3)) is .29, faster than for set([1,2,3]) (.42) but still slower than for {1,2,3} (.16). So I will change such instances also. The same timing for frozenset((1,2,3)) (.29) is faster than the best timing for frozenset({1,2,3}), (.36), so

[issue22823] Use set literals instead of creating a set from a list

2014-11-09 Thread Raymond Hettinger
Raymond Hettinger added the comment: [Isn't such changes considered code churn?] This sort of thing is always a judgment call. The patch will affect very few lines of code, give a little speed-up, and make the code easier to read. In the case of the docs, it is almost always worthwhile to up

[issue22823] Use set literals instead of creating a set from a list

2014-11-09 Thread Raymond Hettinger
Raymond Hettinger added the comment: [I will prepare a 3.5 patch for this.] Thanks, I will review when you're done. [How about frozenset([...]) to frozenset({...})? ] Yes, the frozenset() examples should change to match the actual repr: >>> frozenset([10, 20, 30]) frozenset({10, 20, 30}

[issue22823] Use set literals instead of creating a set from a list

2014-11-09 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Isn't such changes considered code churn? If it is not, I have a huge patch which makes Python sources to use more modern idioms, including replacing set constructors with set literals (I have counted three occurrences not in tests). Are you interesting to l

[issue22823] Use set literals instead of creating a set from a list

2014-11-09 Thread Terry J. Reedy
Terry J. Reedy added the comment: I did not look at Docs yet. I could not repeat the timing results on my machine running from the command line, as I got '0.015 usec per loop' for both, and same for both frozenset variations. Running timeit.repeat interactively and selecting the best reprodu

[issue22823] Use set literals instead of creating a set from a list

2014-11-09 Thread Terry J. Reedy
Terry J. Reedy added the comment: I will prepare a 3.5 patch for this. There are not many instances other than those you found (but several times as many in tests). I presume that most non-test instances were converted by the 2to3 fixer. How about frozenset([...]) to frozenset({...})? There

[issue22823] Use set literals instead of creating a set from a list

2014-11-08 Thread Ezio Melotti
Changes by Ezio Melotti : -- nosy: +ezio.melotti stage: -> needs patch ___ Python tracker ___ ___ Python-bugs-list mailing list Unsub

[issue22823] Use set literals instead of creating a set from a list

2014-11-08 Thread Raymond Hettinger
Raymond Hettinger added the comment: Note, to keep the tests stable, nothing in Lib/tests should be changed. Any update should target the rest of Lib and Doc. -- ___ Python tracker ___

[issue22823] Use set literals instead of creating a set from a list

2014-11-08 Thread Raymond Hettinger
New submission from Raymond Hettinger: There are many places where the old-style of creating a set from a list still persists. The literal notation is idiomatic, cleaner looking, and faster. Here's a typical change: diff --git a/Lib/sre_compile.py b/Lib/sre_compile.py --- a/Lib/sre_compi