Re: [Python-3000] callable()

2006-07-18 Thread Fernando Perez
Greg Ewing wrote: > For that purpose, hasattr(obj, '__call__') is sufficient, > I think. And if it's not, the API you're trying to > implement is ill-conceived in the first place, just like > testing for sequenceness is not a well-defined operation. I should add that for ipython's purposes, it se

Re: [Python-3000] callable()

2006-07-18 Thread Greg Ewing
Andrew Koenig wrote: > I am uncomfortable about exposing the implementation this way, if only > because it would require fixing the equivalence between callable() and > hasattr(obj, '__call__') for all time. I don't see anything bad about fixing that equivalence. I regard the fact that it *wasn't

Re: [Python-3000] callable()

2006-07-18 Thread Greg Ewing
Guido van Rossum wrote: > But I'm not proposing to use hasattr(obj, '__call__'). I'm basically > saying that the callable test has very little to do with whether the > later call will succeed, because we have no way to test the signature. I don't think that's needed for the sort of things people

Re: [Python-3000] Import system questions to be considered for Py3k

2006-07-18 Thread Giovanni Bajo
Nick Coghlan wrote: > Rationalise *.pkg and *.pth files > - > [...] > > Use an interpreter configuration file? > -- When dealing with these issues, please consider also startup time. Python is already "pretty slow" at startup, an

Re: [Python-3000] callable()

2006-07-18 Thread Andrew Koenig
> Then it becomes a matter of whether it's worth having callable() > around as an alternative spelling. Those arguing in favour of > it would have to explain whether we should also have addable(), > subtractable(), mutiplyable(), indexable(), etc. etc. etc... I'd love to be able to determine wheth

Re: [Python-3000] callable()

2006-07-18 Thread Andrew Koenig
> Andrew Koenig wrote: > > I note in PEP 3000 the proposal to remove callable(), with the comment > "just call the object and catch the exception." > I think that should be amended to "just use hasattr(obj. '__call__') > instead". That's what callable() will become equivalent to once > old_style

Re: [Python-3000] callable()

2006-07-18 Thread Andrew Koenig
> Agreed. I think the people who want to use this as a test for whether > a client passed them a usable object are barking up the wrong tree. > What I do see it as useful for is making an api that accepts a > foo-like-object, or a callable object that returns a foo-like-object. Yes. What really g

Re: [Python-3000] callable()

2006-07-18 Thread Michael Urman
On 7/18/06, Guido van Rossum <[EMAIL PROTECTED]> wrote: > But I'm not proposing to use hasattr(obj, '__call__'). I'm basically > saying that the callable test has very little to do with whether the > later call will succeed, because we have no way to test the signature. Agreed. I think the people

Re: [Python-3000] callable()

2006-07-18 Thread Guido van Rossum
On 7/18/06, Michael Urman <[EMAIL PROTECTED]> wrote: > On 7/18/06, Greg Ewing <[EMAIL PROTECTED]> wrote: > > I think that should be amended to "just use hasattr(obj. '__call__') > > instead". That's what callable() will become equivalent to once > > old_style classes are gone. > > > > Then it becom

Re: [Python-3000] callable()

2006-07-18 Thread Michael Urman
On 7/18/06, Greg Ewing <[EMAIL PROTECTED]> wrote: > I think that should be amended to "just use hasattr(obj. '__call__') > instead". That's what callable() will become equivalent to once > old_style classes are gone. > > Then it becomes a matter of whether it's worth having callable() > around as a

Re: [Python-3000] callable()

2006-07-18 Thread Stefan Behnel
Hi, Greg Ewing wrote: > Andrew Koenig wrote: >> I note in PEP 3000 the proposal to remove callable(), with the comment "just >> call the object and catch the exception." > > I think that should be amended to "just use hasattr(obj. '__call__') > instead". That's what callable() will become equival

Re: [Python-3000] callable()

2006-07-18 Thread Greg Ewing
Andrew Koenig wrote: > I note in PEP 3000 the proposal to remove callable(), with the comment "just > call the object and catch the exception." I think that should be amended to "just use hasattr(obj. '__call__') instead". That's what callable() will become equivalent to once old_style classes are