Like apples left out too long and some orange wines, browned avocado flesh is the result of oxidization. And like other fruits that brown, avocados contain an enzyme called polyphenol oxidase. This enzyme catalyzes phenols, a class of compounds found in avocados, into quinones, which are capable of joining smaller molecules together into long chains. (Otherwise known by their less technical name: gross, browned avocado bits.) This process actually enables avocados to last longer, as quinones are toxic to the bacteria that cause rot, but it shortens the window of time they can be actually enjoyed.
The black, stringy lines you sometimes see in avocado flesh are from damage to the fibers that run longitudinally through the fruit. As Lindsay-Jean put it in the article above, “Stringy avocados are either from young trees (they’ll start to produce better fruit as the tree matures) or were improperly stored.”
While it can be difficult to avoid avocados with stringy fibers—especially as the increasing demand for avocados forces more farmers to harvest from immature trees—purchasing fruit from older avocado farms with established trees is a good place to start. Either look online for information on your sellers or ask farmers at your local market how old their trees are—while avocado trees start bearing fruit at three to five years, they don’t reach full maturity until five to seven years.
When avocados are overripe, they take on the similar brown color of avocados that have had a bit too much air—and like the oxidized fruit, they may have a funky flavor. But they're still completely safe to eat, just like the over-ripe banana you put into your banana bread. (Try them in a salad dressing or a smoothie.)