Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
For loop + add something
#11
(Jun-23-2022, 11:04 PM)Pedroski55 Wrote: Knowing a list is in fact an integer indexed array, the index beginning with zero, why not make use of that fact and the relationship of the length to the indexing? Simple and useful!

Often the only thing you know: This object is iterable ...

I guess you come from another language and try to apply the convention of the language you've learned to Python. We often see the results in existing libraries, which look like Java (getters/setters everywhere).

If you want to make it more difficult and unflexible, then you should use indices everywhere.
I showed you an example, where the Code breaks. Why ignoring it?
Almost dead, but too lazy to die: https://sourceserver.info
All humans together. We don't need politicians!
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020