On Sep 18, 2015, at 16:58, Sven R. Kunze email@example.com wrote:
On 19.09.2015 01:47, Ryan Gonzalez wrote: What about "apply"? It's the closest thing to "fmap" I can think of that won't coblnfuse people...
Are you sure? I think "maybe" better reflects the purpose of "?".
Nevertheless, I would love to see support for the maybe monad in Python.
I think this, and the whole discussion of maybe and fmap, is off the mark here.
It's trivial to create a maybe type in Python.
What's missing is the two things that make it useful: (1) pattern matching, and (2) a calling syntax and a general focus on HOFs that make fmap natural. Without at least one of those, maybe isn't useful. And adding either of those to Python is a huge proposal, much larger than null coalescing, and a lot less likely to gain support.
Personally, whenever I think to myself "I could really use maybe here" in some Python code, that's a sign that I'm not thinking Pythonically, and either need to switch gears in my brain or switch languages. Just like when I start thinking about how I could get rid of that with statement with an RAII class, and maybe an implicit conversion operator....