[Python-3000] PEP 3100 Comments

Guido van Rossum guido at python.org
Sun May 7 17:40:01 CEST 2006


On 5/6/06, Talin <talin at acm.org> wrote:
> I want to say that I agree with everything in PEP 3100 except for two things:
>
> 1) Getting rid of 'callable'.
>
> The reccomended replacement is "just call the object and catch the resulting
> exception", but I can think of a lot of situations where that wouldn't be
> appropriate. For example, what if you want to know if something is
> callable, but you don't want to call it just yet?

This has already been shot down by others (if you still disagree, too
bad for you, you're wasting your time). Let me just add that knowing
it is callable isn't sufficient to ensure that calling it with a
particular signature won't raise an exception. We could add something
much more useful once we have signature checking in place; but it
won't be called "callable" and it will likely have false negatives (if
the signature info is unavailable) rather than false positives (like
current callable()).

> What if you intend on calling something 1000 times, and you'd like to
> know if its callable once, instead of catching the exception 1000 times?

You could catch the exception only once, and then you'd disable the
bad callback -- if you cared at all. More likely you'd just let the
user figure it out from the first error and not worry about the rest.

> 2) I think that 'print' should stay a statement; If you want to add a functional
> equivalent, that's fine, but the simplicity of the current statement is a win.
> (Plus I like not having to type the parens; the less delimiters, the more
> readable the code IMHO.)

You obviously weren't here when this was discussed. Having it be a
function, always, is useful in many ways, several of which can be
summed up as "future transformations". E.g. turn all print statements
into log calls. This is much easier when they are already calls. Also,
the various syntactic quirks (significant trailing comma, weird >>
syntax) require time to learn and to explain.

--
--Guido van Rossum (home page: http://www.python.org/~guido/)


More information about the Python-3000 mailing list