Woah-wee! 🤯 Python's strings can check for prefixes & suffixes like a boss! No more slicing business! Just use `startswith` and `endswith`. Check it out here: [link] #PythonMorsels 🚀☁️
Last Night i was happy because I solve my first #PythonMorsels problem... today @treyhunner showed me that it wasn't the more pythonic way... so I learned something new about #python
Came up with something pretty elegant for #PythonMorsels#parse_ranges I think
😬
Also handles more edges cases than described in the tests file:
* more than 2 ints in each range
* any arbitrary chars within each range
* out-of-order ints within range
gist.github.com/vindard/5125b1…
Learned a new #Python thing again today, specifically about how `yield` works --> turns out there's also a `yield from` that's pretty handy when yielding from an iterable #PythonMorsels#deep_flatten
@treyhunner@Wikipedia Another win for deques (in Python at least) that I was wondering about the other day!
Inserting into lists is expensive since the address of every other element must be amended (as I suspected). Apparently it's not the same with deques #PythonMorsels#deep_flatten
Had to do quite a bit of error checking on this one to get it to pass the included tests satisfactorily 😅 #PythonMorsels
(I could've avoided ALL error checks by setting default value of `start` to 0, but then this would exclude edge cases not in tests)
gist.github.com/vindard/80f4c2…