On Tue, May 17, 2011 at 2:02 PM, Joe Leonardo <[email protected]>wrote:
> Hey all,
>
>
>
> Totally baffled by this…maybe I need a nap. Writing a small function to
> reject input that is not a list of 19 fields.
>
>
>
> def breakLine(value):
>
> if value.__class__() != [] and value.__len__() != 19:
>
>
This should use an "or" test, not "and". And is probably better written as:
if not isinstance(value, list) or len(value) != 19:
That would allow for subclasses of list, assuming that would be okay.
--
Jerry
--
http://mail.python.org/mailman/listinfo/python-list