python for loop

Ricardo Aráoz ricaraoz at gmail.com
Wed Apr 1 16:26:26 CEST 2009


Lada Kugis wrote:
> On 01 Apr 2009 01:26:41 GMT, Steven D'Aprano
> <steven at REMOVE.THIS.cybersource.com.au> wrote:
>
>   
>> Why Python (and other languages) count from zero instead of one, and 
>> why half-open intervals are better than closed intervals:
>>
>> http://www.johndcook.com/blog/2008/06/26/why-computer-scientists-count-from-zero/
>> http://www.cs.utexas.edu/users/EWD/transcriptions/EWD08xx/EWD831.html
>>     
>
> steven, thanks for answering,
>
> yes, i saw the second one a little time ago (someone else posted it as
> well in really cute handwriting version :) and the first time just
> now, but the examples which both of them give don't seem to me to be
> that relevant, e.g. the pros don't overcome the cons.
>
> imho, although both sides (mathematical vs engineer) adress some
> points, none of them give the final decisive argument.
> i understand the math. point of view, but from the practical side it
> is not good. it goes nicely into his tidy theory of everything, but
> practical and intuitive it is not. as i said, being an engineer, i
> tend towards the other side, so this is biased opinion (nobody can be
> unbiased) but from a practical side it seems unpractical for
> engineering problems (and to me, the purpose of computers is to help
> humans to build a better world, not to prove theories - theories are
> useless if they don't help us in reality. so we should try to adapt
> computing to real world, not our world to computers).
>   
Speaking about "reality", it would have saved a lot of time (but maybe
not fun) to just do :

>>> myRange = lambda x : range(1, x+1)
>>> myRange(4)
[1, 2, 3, 4]

Put it in a file named "MyIntuition.py" in the python path, and then in
your programs you can code :
from MyIntuition import myRange




-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20090401/0d3fbe56/attachment.html>


More information about the Python-list mailing list