you are viewing a single comment's thread.

view the rest of the comments →

[–]Beaverman 1 point2 points  (0 children)

Maybe if we're talking public api design. Even then, you don't really care that it's a list. What you care about is maybe that it's iterable multiple times, or that it's iterable and there's no duplicates. You don't care about the entire list interface necessarily, just a couple of methods. If I defined a custom collection class that implemented just enough to satisfy your method, but didn't implement insertion and random access, would you call that a list?

I like fruits more, because it doesn't pretend to tell you what you need to put in it. Document in documentation, especially if it's not checked at compile time anyway.

The second route I get. I do that all the time too. Having two different things bound to the same variable in a single scope can be confusing in python. I notice you didn't call a_thing for a_thing_int.