"no variable or argument declarations are necessary."

Antoon Pardon apardon at forel.vub.ac.be
Mon Oct 3 08:59:04 CEST 2005


Op 2005-10-03, George Sakkis schreef <gsakkis at rutgers.edu>:
> "Michael" <ms at cerenity.org> wrote:
>
>> James A. Donald wrote:
>> > On Sun, 02 Oct 2005 17:11:13 -0400, Jean-Francois Doyon
>> > James A. Donald:
>> >>  > Surely that means that if I misspell a variable name, my program will
>> >>  > mysteriously fail to work with no error message.
>> >> No, the error message will be pretty clear actually :)
>> > Now why, I wonder,  does this loop never end :-)
>> > egold = 0
>> > while egold < 10:
>> >    ego1d = egold+1
>>
>> I know (hope! :-) that's a tongue-in-cheek question, however the answer as
>> to why that's not a problem is more to do with development habits rather
>> than language enforcement. (yes with bad habits that can and will happen)
>>
>> [snipped description of test-driven development culture]
>
> As an aside, more to the point of the specific erroneous example is the lack of the standard python
> idiom for iteration:
>
> for egold in xrange(10):
>     pass
>
> Learning and using standard idioms is an essential part of learning a language; python is no
> exception to this.

Well I'm a bit getting sick of those references to standard idioms.
There are moments those standard idioms don't work, while the
gist of the OP's remark still stands like:

  egold = 0:
  while egold < 10:
    if test():
      ego1d = egold + 1

-- 
Antoon Pardon



More information about the Python-list mailing list