> Perhaps you meant this?
> 
> assert isinstance(user, User)

Yes I meant this,sorry,my mistake.

------------------------

Thx for your and Ben's feedbacks first,it's appreciated.
your points is taken by me,but I want to make my opinion more clearly.

The assertion is JUST show to my function callers during development,warning 
that "I want a list/tuple,not some other objects"(BTW, your practice of 
wrapping arguments to iter is good,I'll take this to improve my code,thx 
again.).And assertion's off when running Python with the -O (optimize) switch 
is what I expect,it isn't necessary in production code.Argument validation is 
done by constuctor of object which I used in assertion.

I also have a few words about duck-typing.Duck-typing is good,but how about if 
I offer a convenient way to my function user by producing or changing what he 
want to pass me to a *real* duck?Is that more explicit to my user?

Anyway,I'll look at my principles which may need some changes or improvements.
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to