This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author ethan.furman
Recipients Claudiu.Popa, belopolsky, christian.heimes, ethan.furman, ionelmc, jedwards, llllllllll, terry.reedy
Date 2015-04-18.05:31:16
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1429335077.02.0.122901621653.issue23990@psf.upfronthosting.co.za>
In-reply-to
Content
Python 3.4.0 (default, Apr 11 2014, 13:05:18) 
[GCC 4.8.2] on linux
Type "help", "copyright", "credits" or "license" for more information.
--> class NonIter:
...    pass
... 
--> list(iter(NonIter()))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: 'NonIter' object is not iterable

--> class MaybeIter:
...    @property
...    def __next__(self):
...       raise AttributeError
...    def __iter__(self):
...       return self
... 
--> iter(MaybeIter())
<__main__.MaybeIter object at 0xb6a5da2c>  # seems to work

--> list(iter(MaybeIter()))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "<stdin>", line 4, in __next__
AttributeError

This is exactly analogous to what you are seeing with __call__ and callable().

I am not opposed to "fixing" callable(), I'm opposed to fixng only callable().  If you want to have the descriptor protocol be given more weight in dealing with special methods (aka magic methods aka dunder methods) then be thorough.  Find all (or at least most ;) of the bits and pieces that rely on these __xxx__ methods, write a PEP explaining why this extra effort should be undertaken, get a reference implementation together so the performance hit can be measured, and then make the proposal.
History
Date User Action Args
2015-04-18 05:31:17ethan.furmansetrecipients: + ethan.furman, terry.reedy, belopolsky, christian.heimes, ionelmc, Claudiu.Popa, llllllllll, jedwards
2015-04-18 05:31:17ethan.furmansetmessageid: <1429335077.02.0.122901621653.issue23990@psf.upfronthosting.co.za>
2015-04-18 05:31:17ethan.furmanlinkissue23990 messages
2015-04-18 05:31:16ethan.furmancreate