66

I would like to ask about answers to this question: How do you change the size of figures drawn with matplotlib? This is an 8 year old, highly frequented question with over half a million views. It is also the top result when googling matplotlib change figure size, which is a very common task working with matplotlib.

Apart from the top voted answer, there is another very good solution, stating that the figure size can be set using rcParams. To do so this answer imports pylab. This was fine at the time the question was asked and answered. However, by now, the use of pylab is being deprecated for different reasons. The matplotlib usage guide says about that:

pylab is a convenience module that bulk imports matplotlib.pyplot (for plotting) and numpy (for mathematics and working with arrays) in a single name space. Although many examples use pylab, it is no longer recommended.

It would therefore be appropriate to change the answer, which currently looks like this

enter image description here

to instead use matplotlib.pyplot like this

import matplotlib.pyplot as plt
plt.rcParams['figure.figsize'] = 5, 10

The question is: Is this appropriate?

I'm not a big fan of editing answers. However, the reason I would like to change this answer is that it seems to be often used by a lot of people (also by people later asking new questions on SO) and it would be good if they didn't use a depreciated code.
The reason I'm asking here is that there is another answer from half a year ago on this thread, which does exactly this

enter image description here

Editing the original answer would then somehow make this new answer meaningless. For which one might argue that it already is, since technically, using rcParams is a known solution for 8 years already.
We could of course also wait till the new answer gets 200 upvotes and stays above the old one, but until then it might not be obvious to everyone that they should not be using pylab.

Can someone give an experienced suggestion on how to handle this (and if the answer is to edit the old answer, what to do about the new one)?


(This is no duplicate of this question because my question directly addresses a very specific case where the answer itself is acutally correct and only some header code is leading to a desirable edit.

Update: I now made the proposed edit on the answer and left a comment below it, explaining it. The reason is that this edit does not change the solution, nor the meaning, nor the author's intention and is thereby clearly encouraged by the help center, where, as @Braiam points out in his answer, it says

Editing is important for keeping questions and answers clear, relevant, and up-to-date. Common reasons for edits include: [...] To correct minor mistakes or add updates as the post ages"

Update2: The answer in question has now been locked at a state which does not reflect any of the discussed options. It now looks like this:

enter image description here

The last edit before it was locked has been made by @FĂ©lix Gagnon-Grenier and while he and others here argue that no edit to the code should be made, the edit yet has a different code than the original post. So if people think that no edit whatsoever should be made to the code, one would need to rollback the answer to the 2011 version where the code was from pylab import * instead of from pylab import rcParams. There was good reason to change this back then, and the edit I am proposing here is actually in the same direction, changing the import to be better suited for people's needs and avoiding unnecessary imports if used in larger projects.
I would at this point ask people to think over their argument of "not changing code" and give an explanation of why the 2014 edit of the question is acceptable and the edit discussed here is not in their view.

Second, the answer as it is now is certainly the worst of all possible solutions, because it starts with a big yellow deprecation warning (btw. yellow is not meant to be used for such things). This will for sure lead people not to use this solution, which is not at all what we want. We want to let them use the solution, but the solution should be imported from pylab and not from pyplot. A lot of people who are active in this thread have never actually worked with python and its module structure, so it seems necessary to remind them that the actual python object rcParams is the same in both cases.

As said, the answer as it currently is, needs to change. I could imagine to roll back to 2011 and add a note about using the newer answer instead, which to me just adds a lot of unnecessary noise to the question, but would be consitent with the "no code editing" strategy. Or, we could just do the proposed edit with a note that this edit has been performed.

28
  • 68
    Before the "don't edit anything ever" crew descends, the help center explicitly tells you that you can do that. "Editing is important for keeping questions and answers clear, relevant, and up-to-date. If you are not comfortable with the idea of your contributions being collaboratively edited [...] this may not be the site for you. [...] Any time you see a post that needs improvement and are inclined to suggest an edit, you are welcome to do so. [...] Common reasons for edits include: [...] To correct minor mistakes or add updates as the post ages"
    – Braiam
    Jul 9, 2017 at 19:05
  • 4
    So, knock yourself out. There's nothing in the help center that prohibits you and yet many things that invites you to do so.
    – Braiam
    Jul 9, 2017 at 19:09
  • 2
    I know that I can edit it. But if I do so, I would be interested in knowing what to do with the other answer that would then become identical. I would therefore rather like to see comments and answer from experienced editors that suggest a good strategy on this. Jul 9, 2017 at 19:10
  • 4
    There's no "strategy", just do it.
    – Braiam
    Jul 9, 2017 at 19:12
  • 6
    I would also add that the answerer is an unregistered user last seen in 2008, so they're note likely to come back and update the post themselves. Jul 9, 2017 at 22:26
  • 2
    @ImportanceOfBeingErnest I regret you doing as you did, while there was obviously no community agreement. I rollbacked to the second version. I would have preferred we go the "let's agree on something" way, but apparently Braiam's inflamatory ways won your heart. Let's escalate this to an edit war, I guess, until moderators hammer everyone. If you wish to do as you well please, so can everyone else. Jul 10, 2017 at 17:42
  • 8
    while updating an old answer, please, do not remove the corresponding old working code. 8 years is nothing, I've recently had to adapt for a new environment a code base that is 20 years old -- do not underestimate how long software may live.
    – jfs
    Jul 10, 2017 at 17:47
  • 2
    @J.F.Sebastian the code is on the review history for all to see. If you want to go back, you can go back, but do not hold back those trying to move forward!
    – Braiam
    Jul 10, 2017 at 18:11
  • 2
    The problem here, is it have nothing to do about the domain. Stack Overflow is bigger than one python question, and no, you are not encouraged to change the content of an answer to the point where all the upvotes actually lose their meaning. Jul 10, 2017 at 19:14
  • 2
  • 6
    @Braiam: To be honest there are a lot of things the Help Centre says that don't actually match consensus in reality. And consensus in reality is that broad edits are to be frowned upon, especially when lots of people have already voted on the older content. Jul 10, 2017 at 19:48
  • 4
    To the non-domain-savvy interferers (cc. @FélixGagnon-Grenier, good job with your edit war by the way): as far as I know this is not deprecation in the "usual" sense when something no longer works in a newer version. Users of old versions of matplotlib will not suddenly find a uselessly up-to-date answer. It's more of a shift in best practices. Pylab is a convenience module that combines numpy and pyplot in the same namespace, which is exactly the reason why it's one huge bulk of a module that should just be avoided, using pyplot and numpy separately if needed. (Correct me if I'm wrong) Jul 11, 2017 at 0:26
  • 2
    My point was rather that J.F. Sebastian's concerns are invalid. But whatever rocks your boat, @Félix :P Jul 11, 2017 at 12:34
  • 2
    @AndrasDeak the description of the background you give is technically absolutely correct. Is there any conclusion you would draw from that concerning the question? Jul 11, 2017 at 12:47
  • 2
    Well, there's a reason I haven't taken a stance regarding the actual post in question. Based on the suggested edit not breaking anything across versions, I think it should be fine. Based on my concerns for duplicating answers, the edit is not fine. But ultimately, this is the third-top-voted answer on a question where the top ones are younger and have double the votes, so I don't see this post crucial in any way, thus my final assessment is "meh" :) Jul 11, 2017 at 12:53

9 Answers 9

-19

Is this appropriate?

That's the wrong question you are asking yourself. The question is: does it makes the post more useful? That's the only thing that matters. There's no draconian rules that you have to follow, so long as you respect the author and don't alter the meaning you are good to go.

Other questions you could ask yourself are: which is more helpful to the reader that has the same problem stated in the question: an edit that improves the answer? Or... leave it like that? Which of these is more helpful to future readers? Whom will help by the actions you will take on the post?

Changing function names or restricting the modules loaded when they are not critical to the solution is a good thing. It makes the solution more portable, as it introduces less variables and doesn't pollute the namespace.

Recommended read:

BTW, and this is only for the lulz... there was an edit that replaced a wild import (the from lib import * thing), to something less broad as "rcParams" in revision 3, and was to the date uncontested. Someone is trying to do the same thing, and is now contentious...

19
  • 24
    Ignoring the specific post for a second, I'm not sure I'm convinced by your reasoning. This would suggest that it's OK to edit any answer by "stealing" content from other, competing answers. It would surely improve the target answer, making it more useful. It would also be inappropriate. And in this hypothetical scenario I'd be more influenced by the latter aspect. Jul 9, 2017 at 22:28
  • 7
    It's only inappropriate so long as it makes it worse @Andras. Remember "this site is collaboratively edited", so there are only winners if the best information is put on top. When the site was created, the creators envisioned that each question would have 1 collaborative edited answer on the very top, the "competition" is just there to motivate people to get better (gamification...), not to prevent the site from being better.
    – Braiam
    Jul 9, 2017 at 22:32
  • 7
    I don't think that would be applicable in any way to Stack Overflow. It could be a working model of a Stack Overflow in an alternate timeline, but not the one we live with. You know, the one with hordes of robo-reviewers, askers who won't even try to google their error message, and swarms of rep farmers who jump on every single blatant duplicate. Right, the greater good of building a repository of knowledge... I believe your answer is on a wrong timeline ;) Jul 9, 2017 at 22:37
  • 1
    "The only thing necessary for the triumph of evil is for good men to do nothing." @Andras. The existence of robo-reviewers shouldn't mean that we should stop, au contraire, we should redouble efforts to make things right. The number of needed reviewers was decreased back to 2 since "there's no particular need for the number of reviews per edit to remain at 3 on Stack Overflow". Steps are being taken, so cheer up!
    – Braiam
    Jul 10, 2017 at 0:00
  • 4
    Keep in mind that what's best is sometimes subjective. You may have upgraded to Java 8, while the majority is still on Java 7 etc. The community is here to collectively judge which answer is the best by voting. I would presumably argue that my answer is better than the other answers (otherwise I would have written it differently). This doesn't mean that I should edit the top answer write some version of my answer in it's place. Also: If the top answer has 100 votes, and I edit it, I potentially "betray" those 100 votes and make it look like they have voted for the new version.
    – aioobe
    Jul 10, 2017 at 6:51
  • 1
    @aioobe the best answer is objective: the most sensible and general solution. I've said since long ago that answers should be as timeless as possible, since that gives the most usefulness for as long as possible.
    – Braiam
    Jul 10, 2017 at 12:37
  • 12
    @Braiam, I respectfully disagree. I don't think that it's always objective which answer is best.
    – aioobe
    Jul 10, 2017 at 12:50
  • 1
    @aioobe Braiam explicitly made an exception in his answer for edits that would alter the answer's meaning or disrespect the original author, both of which I think would cover someone editing an answer to replace it with their own answer. Jul 10, 2017 at 12:52
  • @Braiam you left a very useful comment below the question, which tells that the help center itself encourages the kind of edit I'm suggesting. Would you mind, linking that in your answer, such that it is all in one place? Jul 10, 2017 at 14:45
  • @ImportanceOfBeingErnest well, you know you could have edited it in ;)
    – Braiam
    Jul 10, 2017 at 14:48
  • Haha ;-) Concerning your answer, I don't want to mess with answers of people that are still active, so it's better to let them provide their answers the way they like. Concerning the answer in question: Well I know that I could have just edited the answer, without asking about it here. Given all the more or less opinionated answers here, that is what I should have done already yesterday. Also I now see your point about the crew. ;-) Jul 10, 2017 at 14:53
  • 7
    I disagree with this kind of edit. Someone looking specifically for the old (now changed) answer will not find it anymore. Also he/she will likely not look into the history of the changed answer. A notification on top with a reference to the new answer is better IMHO. Users looking for up-to-date code, will follow the link. Users looking for the old answer are happy that it is still there. Judged by the votes: The Deprecation note is the better tool. At least in this case.
    – Mischa
    Jul 10, 2017 at 15:13
  • 2
    @Mischa it might also be that you are not too much into python and misinterprete this as a change in the solution, which it really isn't. There is no "user looking for the old code", as people who know about the structure of matplotlib will anyway use pyplot instead of pylab, and people not knowing about it shouldn't be bothered taking a link to some other answer or thinking about pylab at all. Jul 10, 2017 at 15:32
  • 2
    @MischaBehrend This have nothing to do about specific domains, don't let people fool you. This situation happens in any domain, and that this one be about python is completely irrelevant. The course of actions stays the same whatever the domain is, and it should be what is proposed in the answer on which we actually agree. Jul 10, 2017 at 17:51
  • 4
    I am unable to discern how it is possible to respect the author and not change the meaning while changing his answer to a different one, OP should post his own answer, or comment on the one that is now outdated.
    – user207421
    Jul 11, 2017 at 6:12
49

TL;DR
You shouldn't change the obsolete answer to a more up-to-date solution, because it is not desirable that it becomes an exact copy of the newer answer, and because that piece of outdated information could still be relevant to readers.


Updating the obsolete answer could've been deemed acceptable in this particular situation due to the change involved that might be considered a minor improvement, if there was no other answer that the updated answer would've had to compete with.

However, in most cases (like this one) it is a newer answer that brings the attention of the community to the fact that there is a more up-to-date solution available. Should the author of the newer answer have edited the obsolete one instead of writing his own? It could have done so, in this particular situation, because of the minor edit involved. However, he has choosen to post a new answer, which is the generally recommended approach, and it was upvoted by the community. This way, his contribution was recognized, and he got reputation from it.

Therefore, you should edit the obsolete answer so as to include a note making it clear that, for newer versions of the library, the proposed solution is actually deprecated. Such note could look like this:

**Deprecation note:**
As per the [official Matplotlib guide](https://matplotlib.org/faq/usage_faq.html#matplotlib-pyplot-and-pylab-how-are-they-related),
usage of the `pylab` module is no longer recommended.
Please consider using the `matplotlib.pyplot` module instead,
as described by [this other answer](https://stackoverflow.com/a/41717533).

----------

This strategy is preferable because it is applicable to a broader set of cases and it is well-established, so I'd go for it anytime the problem arises, with no exceptions.

This is documented in this highly-upvoted answer of mine, which I'm editing to include the specific case of answer duplication highlighted in your question, and using as the reference for voting to close this post as duplicate.

For further discussions, join chat.

18
  • 10
    This is rubbish. You should edit the obsolete answer, merely because it's obsolete. All answers deserve to be the best possible answer. Not doing it is a disservice. See meta.stackexchange.com/q/261817/213575 Oh, and the "new" answer is a duplicate answer, because it has the same core solution as the "old" one.
    – Braiam
    Jul 10, 2017 at 14:18
  • 5
    Achieving the same result does not make it a duplicate. Even if it's internally exactly the same code.
    – Mischa
    Jul 10, 2017 at 14:24
  • 4
    This should have been done. Which is also reflected by the votes.
    – Mischa
    Jul 10, 2017 at 15:11
  • @MischaBehrend do you know that this answer has only 12 upvotes, yet there's another wth 17?
    – Braiam
    Jul 10, 2017 at 15:20
  • 5
    you know that I don't have 1.000 Rep, so I'm not allowed to see the exact counts? I only see the end result (which also should be the one that matters). And the end result at this moment is, that this answer is the only one with a score greater than 0. Which then tells me, that people favor this.
    – Mischa
    Jul 10, 2017 at 15:30
  • 7
    @MischaBehrend don't let yourself be bullied. The fact that the net score is 0 is what is important here: people do not agree with the other solution, as a group, and people agree more to this one, as a group. That exactly 21 people were for and exactly 21 were against says exactly what we need to know: that 0 scored solution is not agreed upon. Jul 10, 2017 at 17:46
  • 1
    I think it's funny that my answer, which says basically the same thing, has a net negative score, while this answer is strongly positive. Oh well...at least the useful information is here. Jul 10, 2017 at 19:15
  • @PeterDuniho what's actually funny is that there's a revision which did the very same thing OP is asking about, and nobody has contested it.
    – Braiam
    Jul 10, 2017 at 21:41
  • 3
    @Braiam "Obsolete" is relative. Do you have any idea how much of the world runs on "obsolete" code? Most of it does. Jul 11, 2017 at 8:40
  • @Carpetsmoker where in the world you get that idea? Do you really have any data to support your claim?
    – Braiam
    Jul 11, 2017 at 10:16
  • 2
    @Braiam Do you have any data to show that the information in the answer you're deleting isn't useful for people? The burden of proof is on you, not me, as it's you who wants to effectively delete an answer. Jul 11, 2017 at 10:19
  • 7
    @Braiam No, that is what's happening. The information isn't available in any other answer, and replacing the answer with something newer is effectively deleting the answer. I have zero problems amending the answer, but replacing the contents is a very different story. This is pretty much the same as all the discussions about replacing Python 2 with 3, or Objective C with Swift, except more minor. It's been discussed many times already and the consensus on the matter is pretty clear. You may not like that consensus and that's okay, but I don't understand why you keep beating the horse. Jul 11, 2017 at 10:23
  • 5
    Well, it changes the import path from pylab to matplotlib.pyplot.plt @Braiam. To any Python programmer with 15 years experience (like, say , me) that is simply not a 'compatible' change, but a change that will only work with certain versions; much like all the import path renames in Python 3. Perhaps the newer command will work in all matplotlib versions? If so, then there's some specific matplotlib import path magic or some such? Pointing out the error in my assumptions would be helpful. Going off on rants about my alleged skills or lack thereof is not. Jul 11, 2017 at 11:33
  • 1
    @Carpetsmoker unfortunately I couldn't find ancient versions of matplotlib online (I tried when this question was asked). It's actually matplotlib.pyplot vs matplotlib.pylab, where the former is a subset of the latter, and the command in the post in question relates strictly to the pyplot subset of pylab. As far as I know and as far as OP here knows, this has always been like this. Matplotlib devs had thought that having access to pyplot (their library) and numpy (fourth-party) under the name of pylab would be useful. Jul 11, 2017 at 18:46
  • 7
    It seems to me that our inability to determine whether or not the new recommended usage is available for all versions of the library is another reason the original code should not be changed. Jul 11, 2017 at 18:58
5

The way I would handle this would be to edit the high-voted answer to say that the method described is now deprecated, and provide a link to the new answer. Something like this:

This method is now deprecated. Please refer to this answer instead.

It might also be worth changing it to something like "now deprecated as of 2017/01/05" if you happen to know when the deprecation occurred.

15
  • 9
    Meh, such "notices" has been proven to be ineffective on worst cases like security vulnerabilities, like this one stackoverflow.com/posts/3422787/timeline, where even after the warning was added the answer continues to retrieve upvotes, on a ~2:1 proportion. It seems like a sensible solution, just that it doesn't solves the fundamental problem: people don't read stuff.
    – Braiam
    Jul 9, 2017 at 23:57
  • 6
    @Braiam Well in that example the formatting is very poor and doesn't stand out at all. I've suggested an edit which would improve that. However a) upvotes don't necessarily mean the answer is being used, just that people like the answer (they could even be upvoting because of the warning notice), and b) this meta post isn't about a security issue so it's far less important. It's also still possible to use the high-voted answer even if it's deprecated.
    – Clonkex
    Jul 10, 2017 at 0:13
  • 2
    "people like the answer" do you not find a problem that people "like" an answer with a security vulnerability at all? It rings several bells on my mind that it's not being actively downvoted despite the warning notice (people should downvote not useful posts, in theory), it takes little imagination what I feel that it's actually being upvoted. "this meta post isn't about a security issue" yet you recommend something that in a far more critical context had little effect, why should anyone use it?
    – Braiam
    Jul 10, 2017 at 0:18
  • 2
    I find this is the most unobtrusive way that still gets the point accross. Also, as this is not a critical security issue, I have no problem if people that can't be arsed to read stall for three months using deprecated material. Jul 10, 2017 at 1:44
  • 1
    @Braiam All I'm saying is you have way too little information to go on to make the claim that my answer wouldn't be a good idea. That security answer answers the OP's question, therefore it's useful and upvotes are valid. With a decently-formatted warning message my answer should work fine. Also, why do you think that everyone searching for encryption would care about how secure it actually is? It's entirely normal to want a quick way to encrypt some random piece of data, just so it can't easily be read. True security isn't always a factor.
    – Clonkex
    Jul 10, 2017 at 1:48
  • 1
    @FélixGagnon-Grenier Exactly! And in my experience, a well-formatted warning message like that works just fine.
    – Clonkex
    Jul 10, 2017 at 1:48
  • @Clonkex Actually, you are the one that doesn't have information. Do you really believe your suggestion is novel in any way?
    – Braiam
    Jul 10, 2017 at 1:53
  • @Braiam lol what? Couldn't you think of a better comeback than that? My suggestion is intended to be a sensible, useful option for the OP to follow, nothing more. It's not intended to be novel, of all things. We don't get rep from upvotes on meta, so there's no incentive for me to make a suggestion other than to help the OP, which was my goal. If you're not going to actually respond to my arguments then please leave.
    – Clonkex
    Jul 10, 2017 at 1:59
  • Well, you are arguing that I have too little information, couldn't actually be you that lacks the information? Have you read meta.stackexchange.com/a/261820/213575? It doesn't do what we want! "The goal is to tend to these answers to bring them in line with current technology"
    – Braiam
    Jul 10, 2017 at 2:08
  • @Braiam I'm not the one making claims though (except to claim you have too little information, and you have yet to counter that claim). If you claim that such notices have been "proven to be ineffective" (your words), you must back up that claim. You have yet to do so. Your latest comment includes a link to another meta post.... but why? What's your point? So some person on the internet finds that Wikipedia's "obsolescence notices" are not effective for them? They're not even saying we shouldn't use them. You need to explain yourself a bit more clearly if you want me to take you seriously.
    – Clonkex
    Jul 10, 2017 at 3:14
  • I don't need to back up my claims, since that already has been proved through the entire site: PEOPLE DO NOT READ. You are doing the equivalent of arguing with me that the sky isn't blue because I haven't presented proof, when the only thing you need to do is go outside. So, go outside, see how many times people complain that people do not read the fine messages through the entire site.
    – Braiam
    Jul 10, 2017 at 3:21
  • @Braiam The difference is that it's already been proved that the sky is blue. You have yet to offer any proof that my suggestion would not work just fine. Your search links mean nothing. So there's a few (60) posts over the life of two meta sites where "people don't read" was said? So? What if that's a tiny minority of opinions? Your "evidence" works the same way product reviews work: it's negatively biased. Very few people post good reviews unless the product is exceedingly good; if it's bad, they will definitely post a bad review.
    – Clonkex
    Jul 10, 2017 at 3:37
  • @Braiam I'm not saying my solution is guaranteed to be good, only that you can't say it won't. Based on the evidence you've provided, it most certainly has not been "proven" ineffective. SO is all about reading. I believe most people will read a well-formatted warning message.
    – Clonkex
    Jul 10, 2017 at 3:37
  • "only that you can't say it won't" ... that's called argumentum ad ignorantiam. And I already demonstrated it, you are one of such samples.
    – Braiam
    Jul 10, 2017 at 4:17
  • 1
    Let us continue this discussion in chat.
    – Clonkex
    Jul 10, 2017 at 4:30
1

As I understand StackOverflow's rules, the best course of action is to edit the post in question to mention that it is using a depreciated feature, then post your intended solution as a new answer; if it is a much superior answer then the voting system should see to it that it eventually rises to the top.

2
  • 2
    That's a decent approach for some questions, but 210 upvotes will take years to overcome
    – Jeutnarg
    Jul 10, 2017 at 17:18
  • 2
    Couldn't you just edit the solution to say pre version x: answer then version y: answer? Jul 10, 2017 at 18:16
1

After much discussion, here in the comments, in a chatroom dedicated to this question and after asking in the python chatroom, I believe there could be a compromise that would satisfy most, if not all, groups of interest in this discussion.

Then what about a compromise, adding the now recommanded import, linking to the actual answer that features it, and leaving the old content there?

That is, adding the now recommanded way of importing in the answer, so the people can have the right answer right when reading it, while linking to the original, so that the answerer that did put the new way into light still gets credit for their answer, and leaving the old one beneath that, so that history does not disappear, and have a lighter touch for people that dislike such edits.

I propose this:

proposed answer

If an agreement is reached on this, I propose @ImportanceOfBeingErnest, as the OP and domain expert, does the edit after the answer gets unlocked.

0

So... I got carried away by a few things from the comments, and will throw my take on this before I develop brain cancer from keeping it all inside.

Replacing a post with content from another post is called plagiarism.

Literally. An answer that takes content from another answer and adds it to its own corresponds to what plagiarism means, whatever twist of "but I am merely helping the reader" one might one to add to it.

Updating an answer so that it stays up to date can mean adding a deprecation notice.

To correct minor mistakes or add updates as the post ages

Adding and replacing have two separate meanings, look it up. Adding a notice is noticeably [pun intended] closer to the meaning of the words written there.

The upvotes were given on the answer as it was.

However minor the edit might seem, the upvotes were still given on the answer as it stood before, and one should not change the signal of quality on a whim.

This is not tied to the domain.

It's literally a problem that happens in any domain, and is about how we decide, as a community, to inform readers that something is deprecated. Adding a deprecation notice directs traffic towards the right ressources and keeps original intent, however deprecated that original intent can become over the ages.

Very relevant comment from J.F. Sebastian:

while updating an old answer, please, do not remove the corresponding old working code. 8 years is nothing, I've recently had to adapt for a new environment a code base that is 20 years old -- do not underestimate how long software may live.

6
  • 2
    "Replacing a post with content from another post is called plagiarism" no, it's not. Unless you claim it's yours.
    – Braiam
    Jul 10, 2017 at 20:42
  • 2
    If anything is plagiarized here it is the old answer, since the new one took rcParams["figure.figsize"] from it. But honestly this is completely irrelevant here, otherwise every answer that imports some module would be a plagiate of the first answer that imported that module. Same is true for the upvotes: They were given for rcParams["figure.figsize"], not for the import. As I have said in some comment already, the original intent is kept with this edit, as the intent was for sure to tell people about using rcParams["figure.figsize"] in the easiest possible way. Jul 10, 2017 at 20:45
  • 2
    ... I don't really care about arguing with you gang bangers anymore. You obviously have no care about that community consensus you look at with such contempt. What Braiam calls "community rolling on domain experts" in this case looks more like "[so-called] domain experts playing the unique snowflake" card. I disagree with your actions, you will not hear reason and pedantically put yourselves before the community as far as reasonning goes. I don't believe there is anything more to say. Jul 10, 2017 at 20:49
  • Have you considered that community consensus needs to change?
    – Braiam
    Jul 10, 2017 at 21:17
  • 1
    Please see my edit to the question. Your edit, which is currently locked, does not respect the "no code editing" strategy either. So please be consistent in your argument. Jul 11, 2017 at 8:36
  • 1
    Since you seem unaware of the editing history, or of how SO works actually: I used rollbacks. Rollbacks restore a previous state of a question. I was trying to have minimal impact on the changes and rollbacked to the version with the notice, which wasn't written by me. As you are so keen on remembering everyone, I am but a poor not-subject expert, so I wouldn't dare decide if the code should be changed any more, only apply the community decided way of handling the issue. Jul 11, 2017 at 12:17
-1

I say edit the old answer, merge the new answer into the old answer, rephrasing that the old method is deprecated, probably even positioning it below the new one, then set the community flag on the edited answer and let the other answer remain in place. One of the probable actions is also flag the other answer for deletion just on the grounds of that answer be a duplicate of an existing one.

While investigating the question, I have found that the answer quoted here does a different thing that's asked, namely changing the default parameters for all figures rather than parameters for a certain figure. But, even if it's the thing asked, as the title implies "all" figures while the text implies "a" figure, the above stands.

0
-1

You should definitely not remove the old solution from the old answer unless you posted that answer. It may be your opinion that pylab shouldn't be used, but the original poster may not agree, so by changing the answer you would be altering the intention of the post. This is especially true since there is already an answer with your preferred solution.

Rather, you should upvote the answer you prefer and add a comment about why you think it's the better answer. You should add a comment to the older answer saying why you think it's outdated. You should also consider downvoting the older answer, since you seem to think it's now a bad solution.

If enough people agree with you, your preferred answer will be the top answer soon enough, and it's already got enough votes to be highly visible for people looking for a solution. And of course there's always the possibility that people won't agree with you on which solution is better.

In addition, upvoting the answer you prefer sends the rep to the person who provided that answer first, which puts the incentive in the right place for people to improve the site. If random third parties just transfer the content of good answers to top voted inferior answers, that just discourages people from adding better answers to old questions.

-2

There are only general guidelines, no hard and fast rules as to what could be a good edit and what's not one. So, the best you're going to get here are opinions. My two cents…

For me, whether and how you edit an answer depends on a couple of things:

  1. Will the answer be fundamentally the same solution after your edit?
  2. Do you need to edit the code in the answer?

On the first point, if you can't answer "yes", then you should be posting a new answer, not editing an existing one. I think in the example you describe, you can answer "yes".

On the second point, one important guideline when editing Stack Overflow posts is to never made anything other than white-space/formatting edits to code in questions, and in answers, only make changes other than that if you are dealing with an obvious typographical error (i.e. the code couldn't possibly work without your change).

So, the answer to the second question is "no". That doesn't mean you shouldn't edit the answer, but that you should avoid changing the code that's there.

I would say, using these considerations, that the edit you propose would be appropriate, but only by adding your proposed new version of the code, rather than changing the existing one. That is, leave the original code example in place and add a comment explaining the deprecation of the pylab module.

Absent any other relevant answer in the question, you would then add your new version of the code as a separate example in the same question. However, as you've noted, there already exists an answer that describes exactly that.

So, what I would do is instead of adding a new code example, just add the explanation about the deprecation, and then direct readers via the share link on the other answer, to that answer.

Doing it this way preserves the basic structure of the Q&A, while adding the updated information, all without creating redundancy.

Whether redundancy is good is a matter of debate. For me, in this particular context, I'd say it's not good or desirable. But others will disagree (and I'm all for redundancy in other scenarios, where it's useful for safety reasons :) ). You'll need to decide for yourself what approach fits your own philosophical feelings about this kind of thing.

14
  • 9
    "one important guideline when editing Stack Overflow posts is to never made anything other than white-space/formatting edits to code in questions" [CITATION FREAKING NEEDED] Help center says nothing about it, so where this "guideline" comes from?
    – Braiam
    Jul 9, 2017 at 20:52
  • 3
    @Braiam: really? meta.stackoverflow.com/questions/260245/…. Took me about ten seconds to find with this search Jul 9, 2017 at 20:55
  • 1
    And that "faq" goes against the help center. You consider as "guideline" something goes against another more authoritative guideline, like the help center? Most of the stuff in the "don'ts" is explicitly encouraged by the help center.
    – Braiam
    Jul 9, 2017 at 21:01
  • 5
    @Braiam: "Most of the stuff in the "don'ts" is explicitly encouraged by the help center" -- I disagree. You seem to be reading into the Help Center guidance according to your own biases. There certainly is nothing in the Help Center that anyone should take to mean that it's acceptable to make anything other than formatting changes to code in questions. Jul 9, 2017 at 21:06
  • 1
    No, I'm reading into the horses mouth without any bias. The only two, yes two, rules of editing is: clarify meaning without changing it, and always respect the original author. That's the very short summary Shog gives. That's very simple and doesn't align with what you are advocating "not editing code". If anything, you are disrespecting the author by not editing when you can, if it was an inadvertent mistake.
    – Braiam
    Jul 9, 2017 at 21:06
  • 2
    @Braiam: editing code in a question absolutely changes its meaning, which is expressly against the Help Center guidance and the Meta topic that is the elaborated reference. You've yet to demonstrate a single example of "stuff in the "don'ts" [which] is explicitly encouraged by the help center" Jul 9, 2017 at 21:07
  • "editing code in a question" no, it doesn't by default. I can refactor the code of a question, yet trigger the same problem the question is asking about. The meaning is kept, as the code produce the same result.
    – Braiam
    Jul 9, 2017 at 21:09
  • @Braiam: you and I are just going to have to agree to disagree. It's clear to me you came in here with your own personal ideas of what's acceptable and what's not, and are twisting your interpretation of clear guidance here on Stack Overflow to pretend it means something it doesn't. I'm not going to waste any more time debating this with you. Jul 9, 2017 at 21:10
  • "your own personal ideas" I'm quoting the help center and Shog... and it's personal?
    – Braiam
    Jul 9, 2017 at 21:34
  • @Braiam: You didn't quote anything that actually supported your claim. Shog's post doesn't say word one about editing code, and the Help Center guidance is entirely consistent with the reference I provided in recommending against editing code in a question. Jul 9, 2017 at 21:38
  • Shog says everything about editing code, because he's talking about editing! Code or not, it is irrelevant. That meta question came about for a dispute with a very extensive edit (revision 3), which is much more than what this simple correction. But it's easy making it about me, and not about Shog own words.
    – Braiam
    Jul 9, 2017 at 21:41
  • 9
    I consider editing to mention deprecation and direction to updated answer to be be best course of action in the circumstance described. Jul 9, 2017 at 21:42
  • @TerryJanReedy as explained in the other answer that doesn't work.
    – Braiam
    Jul 10, 2017 at 0:46
  • 1
    @PeterDuniho - Note that the FAQ prohibits fixing typos and syntax in a question's code unless they are obviously not relevant to the question. They only don't want you making those changes where you would be fixing or changing the issue the OP is asking about.
    – BSMP
    Jul 10, 2017 at 1:37

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .