[Python-3000] PEP 3100 Comments

Thomas Wouters thomas at python.org
Mon May 8 01:08:18 CEST 2006


On 5/7/06, Talin <talin at acm.org> wrote:

> All right, I'll desist.


[insert distinct sound of persistance]

How about instead of 'callable', an "isFunction' test to go along
> with 'isSequence' and 'isMapping'. (You aren't getting rid of those -
> I hope...?)


He is, and for the same reasons as callable(): there is no way to tell
whether an object is a mapping or a sequence (considering Python object of
both 'types' implement __getitem__, and that's it. If you don't believe me,
ask isSequence about UserDict.). You can guess, but guessing is not what
Python should do. If you want to make your library guess, feel free (and
document it), but it has no place in language specifics.

(On the other hand, it looks like Guido will put in a form of adaptation or
generics, which would solve *both* your problems.)
>
>
> Yet, I feel like in this case I'm being told that my testing of the
> type of an object is "bad style" because it's non-OOP. While there
> may be valid criticisms of this technique, this particular criticism
> seems falsely reductionist.


It's bad style has nothing to do with OOP, but with ducktyping (which is
unrelated to OOP as such.) Python is deeply invested in ducktyping, and it
isn't going to change. At best, there will be (optional)
adaptation/genericity, which is more or less a formalized ducktyping.

I'm not sure that I buy the 'time to learn and explain' argument.
> If we take that to its logical extreme, then we should be
> using Lisp, since there's only a single syntactical constructs to
> learn and explain.


'print' itself is a logical extremity in the other direction, and it proved
its own disservitude in that regard. It's not the vanguard of an assault at
Python's grammar.

--
Thomas Wouters <thomas at python.org>

Hi! I'm a .signature virus! copy me into your .signature file to help me
spread!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/python-3000/attachments/20060508/c991e20f/attachment.html 


More information about the Python-3000 mailing list