Sean Reifschneider added the comment:

I'm thinking that nirs is not thinking of this in the "duck typing"
environment.  Duck typing says that you implement things that are
appropriate for your object type, and code does what it needs to do.  If
the object doesn't support attributes that the code it's passed to
needs, (it doesn't "quack like a duck"), then the code should fail.

I think nirs is thinking that you have to check every attribute before
you use it.  But if the object you implement doesn't reasonably have a
"istty" or "fileno" associated with it, the Python Way is that if you
pass it to code that needs that attribute, that it bomb out.

There may be cases where you might write code that checks for an
attribute, say if the code can provide enhanced functionality if the
attribute is available, but can still provide it's basic functionality
if it does not.

I'm agreeing that I don't think the documentation is incorrect in this case.

I'm thinking that nirs should probably take this to the python mailing
list, and if after discussion there it is believed to still be a
problem, reference the thread here and re-open it.  I'm going to call it
closed for the moment.

----------
resolution:  -> works for me
status: open -> closed

__________________________________
Tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue1126>
__________________________________
_______________________________________________
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to