Closed calebsmith closed 11 years ago
Refs #20
I see what you mean.
I'm trying to think of another way to handle basestring/str in a python 2 vs 3 agnostic way. Perhaps creating something new like "string_type" that either points to str or basestring depending on python version?
It's better to define basestring
for Python 3.
I made the isinstance check more explicit as another attempt at this and a possible way to avoid having to fiddle with differences in python. lmk thoughts.
I also added test cases for bytes and bytearrays because I think we don't want to iterate on them, but return them as is like the way strings are handled.
First off, thank you for fn.py.
I feel like I've implemented flatten() or something like it on several projects. I thought I would contribute a version that doesn't require the input to be nested lists, but nested iterables of any sort (not including strings).
I kept the original tests and added some for the additional behavior. I also changed the docstring to match the new behavior.
I've tried to match my contribution to the existing style, but just let me know if I've missed anything.