On Feb 8, 7:30 pm, Zack <[EMAIL PROTECTED]> wrote:
>[snip]
>
> The generators you show here are interesting, and it prodded me on how
> to add tuples but at the moment (I'm a python newbie) the generator
> seems less readable to me than the alternative. After some input from
> Scott David Daniels I changed some of the unnecessary recursion to
> while loops. I completely over thought my problem. I've fetched pylint
> and I'll be sure to keep it in my toolkit. What does everyone think of
> the code below? Are generator functions a more pythonic (preferred?)
> way of doing things or will my while loops escape mocking? Thanks for
> the feedback this has been a great exercise for me.
>
>[code example snipped]

Your functions look like good candidates for generators, but I
wouldn't mock you for using while loops.

I will say, however, that hasattr(item, '__iter__') isn't a perfect
way of checking whether an object is iterable: Objects that just
define __getitem__ are iterable too (e.g., UserList).
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to