Re: [Python-Dev] Should issubclass() be more like isinstance()?

2006-04-05 Thread Scott David Daniels
Crutcher Dunnavant wrote: > On 4/4/06, Greg Ewing <[EMAIL PROTECTED]> wrote: >> Crutcher Dunnavant wrote: >>> B) issubclass() won't work on a list of classs, >> > the way isinstance() does. >> >> That sounds more reasonable. I can't think of any >> reason why it shouldn't work. There is an issue

Re: [Python-Dev] Should issubclass() be more like isinstance()?

2006-04-04 Thread Georg Brandl
Crutcher Dunnavant wrote: > While nocking together a framework today, I ran into the amazing > limitations of issubclass(). > > A) issubclass() throws a TypeError if the object being checked is not > a class, which seems very strange. It is a predicate, and lacking a > isclass() method, it should

Re: [Python-Dev] Should issubclass() be more like isinstance()?

2006-04-04 Thread James Y Knight
On Apr 4, 2006, at 11:41 PM, Alex Martelli wrote: > IMHO, the solution to THAT very real problem is to supply a built-in > function that catches some exceptions and maps them into suitable > return values. Simplest would be something like: [...] > though I'm sure we can get better syntax if we turn

Re: [Python-Dev] Should issubclass() be more like isinstance()?

2006-04-04 Thread Alex Martelli
On Apr 4, 2006, at 8:18 PM, Crutcher Dunnavant wrote: ... >> There's no rule that predicate cannot raise an exception. > > No, but it makes many applications (such as using it as a test in list > comprehensions) difficult enough to not be worth it. IMHO, the solution to THAT very real problem

Re: [Python-Dev] Should issubclass() be more like isinstance()?

2006-04-04 Thread Crutcher Dunnavant
On 4/4/06, Guido van Rossum <[EMAIL PROTECTED]> wrote: > On 4/4/06, Crutcher Dunnavant <[EMAIL PROTECTED]> wrote: > > On 4/4/06, Greg Ewing <[EMAIL PROTECTED]> wrote: > > > Crutcher Dunnavant wrote: > > > > > > > A) issubclass() throws a TypeError if the object being checked is not > > > > a class,

Re: [Python-Dev] Should issubclass() be more like isinstance()?

2006-04-04 Thread Guido van Rossum
On 4/4/06, Crutcher Dunnavant <[EMAIL PROTECTED]> wrote: > On 4/4/06, Greg Ewing <[EMAIL PROTECTED]> wrote: > > Crutcher Dunnavant wrote: > > > > > A) issubclass() throws a TypeError if the object being checked is not > > > a class, which seems very strange. > > > > If I ever pass a non-class to is

Re: [Python-Dev] Should issubclass() be more like isinstance()?

2006-04-04 Thread Crutcher Dunnavant
On 4/4/06, Greg Ewing <[EMAIL PROTECTED]> wrote: > Crutcher Dunnavant wrote: > > > A) issubclass() throws a TypeError if the object being checked is not > > a class, which seems very strange. > > If I ever pass a non-class to issubclass() it's almost > certainly a bug in my code, and I'd want to kn

Re: [Python-Dev] Should issubclass() be more like isinstance()?

2006-04-04 Thread Greg Ewing
Crutcher Dunnavant wrote: > A) issubclass() throws a TypeError if the object being checked is not > a class, which seems very strange. If I ever pass a non-class to issubclass() it's almost certainly a bug in my code, and I'd want to know about it. On the rare occasions when I don't want this, I

[Python-Dev] Should issubclass() be more like isinstance()?

2006-04-04 Thread Crutcher Dunnavant
While nocking together a framework today, I ran into the amazing limitations of issubclass(). A) issubclass() throws a TypeError if the object being checked is not a class, which seems very strange. It is a predicate, and lacking a isclass() method, it should just return False. B) issubclass() won