What does the idiom "batteries not included" mean?

Solution 1:

"Batteries not included" is a message you might find on the packaging of an electrically powered toy. Essentially it means that you should not expect the toy to work straight out of the box, and that you have to provide an essential component yourself to power it, namely the batteries.

So in this metaphorical context, the comment seems to be suggesting Python's json module does not provide the parser you are looking for, and you might have to put in a significant amount of extra effort yourself to provide what is missing, so as to get the whole thing to work as you expect.

Solution 2:

This is a reference to Python's batteries included philosophy.

The Python source distribution has long maintained the philosophy of "batteries included" -- having a rich and versatile standard library which is immediately available, without making the user download separate packages. This gives the Python language a head start in many projects.

The manual has a section with the same title but that's a poor explanation.

The original quote is much better understood in a "batteries included, this solution is not" way because what it suggests is not adding a battery, much rather powering it via a generator attached to a standing bike so to speak. In other words, the other upvoted answer might be correct in the general sense to explain the generic "batteries not included" phrase but it has nothing to do with the problem at hand.

In this case, it means you would be using the "raw" features of the language and not components already written by others. As another example, you can download a webpage by opening a socket to the relevant IP address port 80, create a request based on the HTTP standard and correctly interpret the response, follow redirect(s) etc. That's the "powered through your own sweat" solution. Or

import requests
requests.get('https://english.stackexchange.com/a/384948/8720')

would be a "batteries included" kind of solution (even if actually requests is not included in the standard library but it serves as a quick demo).