Le dimanche 19 novembre 2006 à 12:44 -0500, George Sakkis a écrit :
> I understand this is not the point you're trying to make, but in such
> cases I usually prefer to make @decorator be equivalent to
> @decorator() by something like:

I could do that, but it's not very clean. Also it doesn't invalidate my
point, since what callable() does is precisely to check that the
parameter conforms to a given interface (instead of explicitly testing
for the underlying implementation e.g. __call__).

I'm not an interface fan at all. Simply, in some cases, it would be
cleaner to check an object implements, or claims to implement, a
conventional interface (which might not even involve any syntactic
checks about the presence of a method), rather than testing for a
specific implementation trait in the hope that it's both necessary and
sufficient.



_______________________________________________
Python-3000 mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-3000
Unsubscribe: 
http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com

Reply via email to