[issue20135] FAQ need list mutation answers

2014-09-29 Thread Roundup Robot
Roundup Robot added the comment: New changeset 138f54622841 by R David Murray in branch '3.4': #20135: FAQ entry for list mutation. (See also 6375bf34fff6.) https://hg.python.org/cpython/rev/138f54622841 New changeset 3d924bbfdcbc by R David Murray in branch 'default': Merge: #20135: FAQ entry

[issue20135] FAQ need list mutation answers

2014-09-29 Thread R. David Murray
R. David Murray added the comment: I accidentally committed the patch early to 3.4/3.5. I've now addressed Ezio's review comment per my suggestion on the review, and committed it to 2.7 as well. Thanks everyone for your contributions. -- resolution: - fixed stage: commit review -

[issue20135] FAQ need list mutation answers

2014-09-27 Thread R. David Murray
R. David Murray added the comment: Here is my version of Ezio's patch. -- Added file: http://bugs.python.org/file36748/mutable_faq.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20135

[issue20135] FAQ need list mutation answers

2014-08-03 Thread Ezio Melotti
Ezio Melotti added the comment: Here is a new patch that includes an additional paragraph about mutation and non-mutation operations. -- Added file: http://bugs.python.org/file36236/issue20135-2.diff ___ Python tracker rep...@bugs.python.org

[issue20135] FAQ need list mutation answers

2014-08-03 Thread Francis MB
Francis MB added the comment: A) On the example: +Also note that some operations (e.g. ``y.append(10)``/``y += [10]`` or +``y.sort()``) mutate are you saying: 1) y.append(10) divided by y += [10] or 2) y.append(10) and y += [10] I don't want to split hairs but reading it fast confused me a

[issue20135] FAQ need list mutation answers

2014-07-11 Thread R. David Murray
R. David Murray added the comment: I think the example would be clarified by speaking about mutation operations versus non-mutation operations. After all: x = [1] y = x x = x + [2] x [1, 2] y [1] At that point including a list += operation would also be beneficial. --

[issue20135] FAQ need list mutation answers

2014-07-11 Thread Ezio Melotti
Ezio Melotti added the comment: Good point, I'll try to add that to the FAQ. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20135 ___ ___

[issue20135] FAQ need list mutation answers

2014-07-07 Thread Berker Peksag
Berker Peksag added the comment: LGTM. -- nosy: +berker.peksag stage: needs patch - patch review ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20135 ___

[issue20135] FAQ need list mutation answers

2014-07-07 Thread Ezio Melotti
Changes by Ezio Melotti ezio.melo...@gmail.com: -- assignee: docs@python - ezio.melotti nosy: +rhettinger stage: patch review - commit review ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20135

[issue20135] FAQ need list mutation answers

2014-07-06 Thread Roundup Robot
Roundup Robot added the comment: New changeset 3881c12fa3ae by Ezio Melotti in branch '2.7': #20135: move FAQ about mutable default arguments to the programming FAQs page. http://hg.python.org/cpython/rev/3881c12fa3ae New changeset 3b7b0f5aac1e by Ezio Melotti in branch '3.4': #20135: move FAQ

[issue20135] FAQ need list mutation answers

2014-07-06 Thread Ezio Melotti
Ezio Melotti added the comment: I moved the FAQ about mutable default arguments to the programming FAQs page. I was going to do a review about new FAQ, but it since I had several comments I just tried to rewrite it and make a new patch. Do you think this is clear enough? -- Added

[issue20135] FAQ need list mutation answers

2014-07-06 Thread Mark Lawrence
Mark Lawrence added the comment: +1 from me, I thought it was crystal clear. -- nosy: +BreamoreBoy versions: +Python 3.5 -Python 3.3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20135 ___

[issue20135] FAQ need list mutation answers

2014-03-24 Thread M. Volz
M. Volz added the comment: Thanks David, I've updated the patch to move the default values question into the programming FAQ where you recommended it go, and also changed the title of the mutable list question. -- Added file: http://bugs.python.org/file34604/sortFAQ_defaultval.patch

[issue20135] FAQ need list mutation answers

2014-03-12 Thread Éric Araujo
Éric Araujo added the comment: I agree; if someone goes to the docs, “Programming FAQ” looks more enticing than “Design and History”. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20135

[issue20135] FAQ need list mutation answers

2014-03-12 Thread R. David Murray
R. David Murray added the comment: M. Votz: I like your entry, but I think it should be titled Why did changing list 'a' also change list 'b'? That's the form I've always encountered this question in. Then the answer can start of with It didn't, 'a' and 'b' are the same list. and then go

[issue20135] FAQ need list mutation answers

2014-03-10 Thread M. Volz
M. Volz added the comment: I've written and attached a patch for the list mutation question. I took a little bit of a different tack on this and addressed a more general question whilst still including list mutation as an example. I know the language can get a little fussy on these sorts of

[issue20135] FAQ need list mutation answers

2014-03-10 Thread Éric Araujo
Éric Araujo added the comment: Resources: http://nedbatchelder.com/text/names.html http://python.net/~mwh/hacks/objectthink.html -- nosy: +eric.araujo ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20135

[issue20135] FAQ need list mutation answers

2014-03-10 Thread R. David Murray
R. David Murray added the comment: I'm in favor of moving the FAQ answer Ezio identified to the Programming section, myself, but I'd like concurrence from at least one other committer before we do it. -- ___ Python tracker rep...@bugs.python.org

[issue20135] FAQ need list mutation answers

2014-03-09 Thread M. Volz
Changes by M. Volz marie...@gmail.com: -- nosy: +mvolz ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20135 ___ ___ Python-bugs-list mailing list

[issue20135] FAQ need list mutation answers

2014-01-17 Thread Ezio Melotti
Ezio Melotti added the comment: http://docs.python.org/3/faq/design.html#why-are-default-values-shared-between-objects -- nosy: +ezio.melotti ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20135

[issue20135] FAQ need list mutation answers

2014-01-17 Thread R. David Murray
R. David Murray added the comment: I *thought* there was a FAQ entry for that. Didn't think to look for it in the design section though :(. Nor is the title likely to catch the eye of someone wondering why their default argument modifications are being unexpectedly persistent. Also, the

[issue20135] FAQ need list mutation answers

2014-01-16 Thread Fran Bull
Fran Bull added the comment: I read the FAQ last night and I couldn't see these answered there either. I would like to try submitting a patch for this one, probably this evening. It will likely be two FAQs in the programming section that go something like: Why does changing one list change

[issue20135] FAQ need list mutation answers

2014-01-16 Thread R. David Murray
R. David Murray added the comment: Thanks for working on this. Technically, defaults are evaluated when the 'def' statement is executed, which is normally, but not always, at the time that the module is first imported (counterexample: nested function definitions). The answer should also

[issue20135] FAQ need list mutation answers

2014-01-16 Thread Fran Bull
Fran Bull added the comment: Perhaps a 3rd FAQ something like this?: Why is changing a list in one instance of a class also changing it in another instance of the same class? This happens: class A(object): ... def __init__(self, fruit=[]): ... self.fruit = fruit ... an_A = A()

[issue20135] FAQ need list mutation answers

2014-01-16 Thread Fran Bull
Changes by Fran Bull fran.b...@gmail.com: -- keywords: +patch Added file: http://bugs.python.org/file33502/20135.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20135 ___

[issue20135] FAQ need list mutation answers

2014-01-10 Thread Terry J. Reedy
Changes by Terry J. Reedy tjre...@udel.edu: -- stage: - needs patch title: mutate list - FAQ need list mutation answers ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20135 ___