What is the difference between PDIP and MDIP?
The LM311 was invented, if memory serves, by National Semiconductor, as were most parts beginning with 'LM'. Since it was introduced (perhaps in the 1970s) it has been second-sourced by other manufacturers including Motorola (now On Semi) and Texas Instruments. In some cases the specifications may be somewhat different, and the packaging will vary by manufacturer and, over time, even within a given manufacturer's line as they make changes.

In 2011, Texas Instruments purchased National Semiconductor and folded the line into their own, updating the data sheets over the next couple of years to elide the National Semiconductor name and replace it with their own. 



In this case, the LM311N/NOPB was the National Semiconductor part (the NOPB was added when lead was eliminated), and LM311P was the TI part. Now they are both TI parts, but they are almost surely made in different facilities and have slightly different specifications. The packages also have slight differences in the plating, and the plastic shipping tubes are different sizes (40 vs. 50 to a tube) etc.  





Also, the TI LM311P datasheet, as of right now, has a rather glaring error- referring to the part as a quad! 



Bottom line, as a hobbyist-user, it makes no difference to you. Pick whichever you like- just as if they were from two different manufacturers. Possibly at some time in the future one of them will be obsoleted- chances are it will be the one that costs more since they are discouraging use of it. PDIP and MDIP are just names used by the two companies before the purchase- to refer to very similar things. 

To a real manufacturer, they are most certainly not the same, and purchasing department may require special dispensation to be able to substitute one for the other, or it may be prohibited in some cases where the substitute has not been qualified or has been found to cause problems. The packages are different as are the chips inside.