In my opinion, you seem to be building logic in the wrong place. Why unixtime n't unixtime know anything about sequencing? In some cases, this would be a good idea (for performance or even semantics), but here it seems that you are adding additional functions to unixtime that do not make sense in this context.
It is best to use (say) a list comprehension:
[unixtime(x) for x in [datetime.now(), datetime(2010, 12, 3)]]
That way, you use the correct Pythonic construct to apply the same thing to a sequence, and you don't pollute unixtime with sequence ideas. You finish the logic of communication (about sequence) in those places where the implementation should be free of this knowledge.
EDIT: It basically comes down to the coding style, reusability and maintainability. You want to split the code well, so when you code unixtime (say) you are only concerned with converting to unixtime . Then, if you are interested in sequences, you develop functionality (or use the built-in syntax) that focuses exclusively on sequences. This simplifies reporting of each operation, testing, debugging, and code reuse. Think about it even in terms of a name: the original function is called unixtime , but your version with a sequence might be more conveniently called by unixtime_sequence , which is strange and offers an unusual function.
Sometimes, of course, you break this rule. If (but only when) performance is a problem, you can combine functionality. But in general, dividing things first into clear parts leads to clear thinking, clear coding, and easy reuse.
Peter source share