> Well, there are at least two libraries on PyPI, and at least one of > them (glom) has been around for some time, but neither is particularly > well known. This suggests to me that this isn't an issue that people > are routinely asking "how do I solve this problem?" (or if they are, > their requirements are sufficiently different that no one solution has > emerged as "the obvious one"). So I struggle to imagine that there's a > significant group of users who are all waiting for a solution in the > stdlib, and for whom installing a library from PyPI is a problem. Actually, I have found a dozen of libraries and I'm sure there are more which I haven't managed to find. You can find my collection here: https://github.com/axonmatics/quickpath/blob/main/README.md#related-work What if people routinely ask this question, but they don't know how to name such functionality? Even if they find some library, the libraries may look unmaintained. Then they may write their own function / library which will never be published.
>> The other way to solve this problem is to have null-conditional access >> operators ?. and ?[] like in C# (i.e. a.b.c can be written to a?.b?.c to be >> prone to None values). > > Well, that's not the *only* other way to solve the problem. Using a > library from PyPI is an entirely reasonable solution as well. You seem > to be discounting that as an option. Can you explain what's wrong with > using a library off PyPI? Just to be clear, I'm one of the stronger > supporters of having an extensive stdlib, so when I say this, I'm > *not* saying that everything should be on PyPI. But it would be good > if you could articulate your reasons for why this specific > functionality is less usable as an external library, that justify it > being in the stdlib. You are completely right. My hypothesis is that people do not use these libraries as they are not aware of them. If such a library would be part of the stdlib, many more people would know about it. The weak point of this reasoning is how we know that this hypothesis is true. The question can be partially answered by looking at questions on stackoverflow. For example: "Access nested dictionary items via a list of keys?" question asked 10 years ago and viewed 152k times since then. Which is not a very high number. I think these functions result in a more compact and readable code. Including such functions in stdlib can be considered as a recommendation to use them as best practice. Including in the stdlib could also reduce the risk that they using some unmaintained lib with questionable quality. > I agree with you somewhat on this point, I don't think anyone has > successfully demonstrated that library-based solutions aren't > sufficient here. But library-based doesn't necessarily mean "in the > stdlib". My point is that accessing an object hierarchy with potentially null elements must be an interesting enough problem if one of the mainstream languages supports this on a language level. _______________________________________________ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/AQDKMRURFNQUMHR736I6THMDIHI5FLN4/ Code of Conduct: http://python.org/psf/codeofconduct/