Use idiomatic approach for is_iterable method#215
Use idiomatic approach for is_iterable method#215askoretskiy wants to merge 2 commits intomahmoud:masterfrom askoretskiy:master
is_iterable method#215Conversation
|
@mahmoud it seems AppVeyor build is broken (not by my changes :-) |
|
Haha, dangi Appveyor, I'll look into that. But first things first. What would you say makes this idiom better than the other. They're certainly both idioms. One reason I went with this route instead of checking the abstract base class was that isinstance checks can be quite slow on inherited classes. Also, I like the directness of this check, whereas I'm pretty sure the |
|
If you check Second issue is that some methods in |
Use idiomatic Python code instead of
try-except.That also makes
iterutilsconsistent -- some methods usedisinstance(obj, Iterable)and some usedtry-except.Also for common methods (
is_scalarandis_collection) use code directly, withoutis_iterable.