Oct-15-2019, 12:27 PM
(Oct-15-2019, 11:52 AM)perfringo Wrote: [ -> ]I agree with buran that his solution is more life-like than oneliner and therefore longer.
One should be defensive and/or generalise (duck-typing) when writing functions. In this particular case - you can through any iterable to it and it behaves as expected. Little longer code now, lot of time saved on debugging in the future.
I'm just a bit shocked that what I thought it was going to be something simple, it is indeed much more complicated than I had expected, probably due to my naïvety and still ongoing huge lack of knowledge.
All the best,
(Oct-15-2019, 12:07 PM)buran Wrote: [ -> ]inflect will not handle list with numerical values, range object or generator expressions. you need to preprocess these and convert to list/tuple with str elements. That's why you get the first error
I guess that I'm going to need much more time than expected sorting out what I had previously thought as an easy-peasy problem.
All the best,