Yeah whatever... (was RE: PEP 285: Adding a bool type)
Ken Seehof
kseehof at neuralintegrator.com
Mon Apr 8 16:06:48 EDT 2002
Jacob Hallén wrote:
> In article <mailman.1018124969.17602.python-list at python.org>,
> Ken Seehof <kseehof at neuralintegrator.com> wrote:
> >> If we ignore the imaginary, which has a very specialized
> scope, we have 5
> >> base types. These can interact in approximately 5! (120)
> >> different ways in a
> >> statement. If we add one more base type we get 6! (720) different ways
> >> that our types can interact.
> >
> >In python the number of numeric interactions is essentially 3!, not 6!.
> >Most of these interactions are trivial and predictable, and are not
> >increased
> >by bool. My brain hurts trying to figure out how to enumerate
> the 6! that
> >you suggest :-) Perhaps in other languages your argument has merit.
> >
> >One thing that I agree with is that one would not be likely to
> add a bool to
> >a complex number. :-)
>
> The difficulty does not come from the legitimate combinations. It
> comes from
> the erroneous ones. Understanding what a correct program does is trivial,
> compared to understanding why an incorrect one does not work.
> The possible number of ways of combining X types is the factorial of X.
It seems like were playing number games to me. This factorial stuff is
mathematically correct, but rediculously abstract and meaningless. To
have a complete understanding of booleans I simply do not have to learn
the difference between:
foo_dict[foo_list[2.0+(x==5)+2L]] and
foo_dict[foo_list[2.0+int(x==5)+2L]]
And then learn the diffence between:
foo_dict[foo_list[2+2.0+(x==5)+2L]] and
foo_dict[foo_list[2+2.0+int(x==5)+2L]]
And then ....
Can you list the rest of the 5*5! new real world interactions that result
from adding bool to python?
Sorry, I just don't get why this is relevant. Let's try to keep this
discussion in the real world, ok?
There are two concepts that I need in order to understand booleans as
added in PEP 285:
0. My understand of the interaction between numbers in python extends
to include all interactions with boolean.
1. The values of True and False behave like 1 and 0 respectively.
That's two (count em), not 5*5! new things to learn.
> Each wrong combination requires the understanding of the error message and
> the reason why it is wrong. A seasoned programmer can classify the errors
> and handle a fair number of these classes. Newbies have a seriously
> difficult time. I would even go as far as to say that it is the most
> important factor controlling how much time a novice programmer needs
> in order to be comfortable with the language.
I have no idea what you are talking about. There are no new kinds of
errors.
False works wherever 0 works and True works wherever 1 works. This is even
true of interactions with lists and dictionaries.
I didn't even need to read to PEP to be fairly certain that my two
assertions are correct (though I read it anyway just to be sure). The
only explanation for any other behaviour would have been that Guido bumped
his head a little too hard before implementing the PEP :-)
You keep talking about error messages. Read the PEP, then give me one
example of an error message caused by using bool instead of int. See?
There isn't one.
<fantasyland>
Hmm... perhaps you have a point... let's see...
>>> x = 1
>>> x[5]
Traceback (most recent call last):
File "<input>", line 1, in ?
TypeError: unsubscriptable object
Ok, so now we add booleans and get an <sarcasm> entirely brand new
</sarcasm> error condition to learn:
>>> x = True
>>> x[5]
Traceback (most recent call last):
File "<input>", line 1, in ?
TypeError: unsubscriptable object
</fantasyland>
Can we get back to the real world now?
- Ken Seehof
More information about the Python-list
mailing list