there seems to be a serious problem with allowing numbers to grow in a
nearly unbounded manner, as int/long unification does: it hides bugs.
most of the time, i expect my numbers to be small. 2**31 is good
enough for most uses of variables, and when more is needed, 2**63
should do most of the time.
granted, unification allows code to work for larger numbers than
foreseen (as PEP 237 states) but i feel the potential for more
undetected bugs outweighs this benefit.
the other benefit of the unification - portability - can be achieved
by defining int32 & int64 types (or by defining all integers to be
32-bit (or 64-bit))
PEP 237 says, "It will give new Python programmers [...] one less
thing to learn [...]". i feel this is not so important as the quality
of code a programmer writes once he does learn the language.
-kartik
Jul 18 '05
83 3465
Andrew Dalke <ad****@mindspr ing.com> wrote in message news:<Z8******* ********@newsre ad3.news.pas.ea rthlink.net>... My guess is the not unusual case of someone who works mostly alone and doesn't have much experience in diverse projects nor working with more experience people.
Hey, that's right.
I've seen some similar symptoms working with, for example, undergraduate students who are hotshot programmers ... when compared to other students in their non-CS department but not when compared to, say, a CS student, much less a experienced developer.
Oops. I'm a grad student, and I certainly don't have as much
experience as a professional developer
-kartik
kartik wrote: "Terry Reedy" <tj*****@udel.e du> wrote in message news:<ma******* *************** *************** *@python.org>.. .
"kartik" <ka************ *@yahoo.com> wrote in message news:94****** *************** *****@posting.g oogle.com...
1)catching overflow bugs in the language itself frees u from writing overflow tests. It is a fundamental characteristic of counts and integers that adding 1 is always valid. Given that, raising an overflow exception is itself a bug, one that Python had and has now eliminated.
If one wishes to work with residue classes mod n, +1 is also still always valid. It is just that (n-1) + 1 is 0 instead of n. So again, raising an overflow error is a bug.
i don't care what mathematical properties are satisfied; what matters is to what extent the type system helps me in writing bug-free code
.... and the point most of your respondents are trying to make is that an
arbitrary restriction - ANY arbitrary restriction - on the upper limit
of integers is unhelpful, and that's precisely why it's been removed
from the language. [...]However, the limit n could be anything, so fixing it at, say, 2**31 - 1 is almost always useless.
i dont think so. if it catches bugs that cause numbers to increase beyond 2**31, that's valuable.
But only if an increase beyond 2**31 IS a bug, which for many problem
domains it isn't. Usually the required upper limit is either above or
below 2**31, which is why that limit (or 2**63, or 2**7) is useless and
unhelpful. The use of fixed range ints is a space-time machine performance hack that has been costly in human thought time.
on what basis do u say that
A few more years' programming experience will teach you the truth of
this assertion. It appears that no amount of good advice will change
your opinion in the meantime.
regards
Steve
-- http://www.holdenweb.com http://pydish.holdenweb.com
Holden Web LLC +1 800 494 3119
kartik wrote: Steve Holden <st***@holdenwe b.com> wrote in message news:<Z6kfd.184 13$SW3.4432@fed 1read01>...
kartik wrote:
Peter Hansen <pe***@engcorp. com> wrote in message news:<_a******* *************@p owergate.ca>... Do you feel strongly enough about the quality of your code to write automated tests for it? Or are you just hoping that one tiny class of potential bugs will be caught for you by this feature of the language?
1)catching overflow bugs in the language itself frees u from writing overflow tests. That seems to me to be a bit like saying you don't need to do any engineering calculations for your bridge because you'll find out if it's not strong enough when it falls down.
i was inaccurate. what i meant was that overflow errors provide a certain amount of sanity checking in the absence of explicit testing - & do u check every assignment for bounds?
If limiting the range of integers is critical to a program's function
then I will happily make range assertions. Frankly I can't remember when
the last overflow error came up in my code.2)no test (or test suite) can catch all errors, so language support 4 error detection is welcome. Yes, but you appear to feel that an arbitrary limit on the size of integers will be helpful [...] Relying on hardware overflows as error detection is pretty poor, really.
i'm not relying on overflow errors to ensure correctness. it's only a mechanism that sometimes catches bugs - & that's valuable.
But your original assertion was that the switch to unbounded integers
should be reversed because of this. Personally I think it's far more
valuable to be able to ignore the arbitrary limitations of supporting
hardware.3)overflow detection helps when u dont have automated tests 4 a particular part of your program.
But writing such tests would help much more.
agreed, but do u test your code so thoroughly that u can guarantee your code is bug-free. till then, overflow errors help.
No they don't.
regards
Steve
-- http://www.holdenweb.com http://pydish.holdenweb.com
Holden Web LLC +1 800 494 3119
kartik wrote: Andrew Dalke <ad****@mindspr ing.com> wrote in message news:<Z8******* ********@newsre ad3.news.pas.ea rthlink.net>...
My guess is the not unusual case of someone who works mostly alone and doesn't have much experience in diverse projects nor working with more experience people.
Hey, that's right. I've seen some similar symptoms working with, for example, undergradua te students who are hotshot programmers ... when compared to other students in their non-CS department but not when compared to, say, a CS student, much less a experienced developer.
Oops. I'm a grad student, and I certainly don't have as much experience as a professional developer
-kartik
You're certainly not short on arrogance, though.
regards
Steve
-- http://www.holdenweb.com http://pydish.holdenweb.com
Holden Web LLC +1 800 494 3119 ka************* @yahoo.com (kartik) wrote in message news:<94******* *************** ****@posting.go ogle.com>... Cliff Wells <cl************ @comcast.net> wrote in message news:<ma******* *************** *************** *@python.org>.. .
[...]i dont give a damn about your rules 4 proper communciation, as long as i'm understood.
Sorry for that.
-kartik
Peter Hansen <pe***@engcorp. com> wrote in message news:<lN******* *************@p owergate.ca>... kartik wrote: thank u so much 4 your help, but i know what i'm saying without assistance from clowns like u. & i dont give a damn about your rules 4 proper communciation, as long as i'm understood.
I feel the need to point out in the above the parallel (and equally mistaken) logic with your comments in the rest of the thread.
In the thread you basically are saying "I want high quality code, but I refuse to do the thing that will give it to me (writing good tests) as long as a tiny subset of possible bugs are caught by causing overflow errors at an arbitrary limit".
Above you are basically saying "I want to be understood, but I refuse to do the thing that will make it easy for me to be understood (using proper grammer and spelling) as long as it's possible for people to laboriously decipher what I'm trying to say".
Sorry al*****@yahoo.c om (Alex Martelli) wrote in message news:<1gmb486.1 l924gm1ing3f9N% al*****@yahoo.c om>... If the many analogies, arguments, and practical examples that have been offered to help you see why, help you accept the fact, good.
They have. Thank you.
-kartik
kartik wrote: [Andrew Dalke]My guess is the not unusual case of someone who works mostly alone and doesn't have much experience in diverse projects nor working with more experience people.
Hey, that's right.
I'm sorry for questioning whether you were a troll. Like I said before,
I spend waaaaay too much time hanging out on troll-infested fora and it
means certain behaviors cause me to automatically dismiss posters. You
seem to have recognized and stopped some of these behaviors.
--
Michael Hoffman
Steve Holden <st***@holdenwe b.com> wrote in message news:<CgMfd.3$u N3.0@lakeread04 >... You're certainly not short on arrogance, though.
I didn't mean to (except in a couple of posts where I got a little
pissed off). Sorry for that.
-kartik
Michael Hoffman <m.************ *************** ******@example. com> wrote in message news:<cl******* ***@gemini.csx. cam.ac.uk>... I'm sorry for questioning whether you were a troll. Like I said before, I spend waaaaay too much time hanging out on troll-infested fora and it means certain behaviors cause me to automatically dismiss posters. You seem to have recognized and stopped some of these behaviors.
No problem (at least compared to some of the other comments ;) ). It's
nice to know that my posts have not been completely useless!
-kartik This thread has been closed and replies have been disabled. Please start a new discussion. |