Let me see if I can tackle these.. On Jun 4, 2006, at 8:33 AM, John Connors wrote: <snip> > The first one is lists... I can't for the life of me understand why a > list > starts at zero. In everything else in life other than programming the > 1st > item in a list is always 1. > > The next thing I don't understand is why the last number in a range is > not > used... <snip> > Once again it defies the logic of everything else we are taught in > life.
This is basically a historical precedent. At one point, long long ago, lists were implemented as a sequence of bytes in memory. The "list" was really the address of the first byte. So the index meant "look this many bytes after the first byte". The first byte was zero bytes after the first byte, so its index was zero. The range thing is similar -- think of the arguments to range being (first index to include, first index to exclude). There have been a few programming languages that have changed this (Pascal comes to mind), but none have fared well. You'll get used to it :) > The 3rd whinge is object oriented programming. I think I understand the > principle behind OOP but in practise, to me, it just makes programs > jumbled, > unreadable and bloated. Just about every summary I have read on Python > says > it is designed to have a simple syntax and is easy to learn. As a > beginner I > can look at Python code and have a very good idea of what is happening > and > why unless it's written in OOP style in which case I have no idea. I will be one of the first to say that OOP is grossly overused in commercial programming -- at some point, middle-management learned that "OOP is good", and demanded that programmers start using it everywhere. Sometimes it's the right tool for the job, and sometimes it isn't. I won't get into the details of that distinction, except to say that simpler tasks tend to not require OOP, while more complex tasks often do. Thus, the non-OOP programs you're looking at are probably performing simpler tasks than the OOP programs. Again, you'll get used to it. One of the nice things about Python is that it lets you write both OOP and non-OOP programs, so you've got a lot of room to experiment and learn OOP style. Java, on the other hand, requires OOP for everything, making it much harder to learn when OOP is and is not appropriate. Dustin -- # Dustin J. Mitchell # [EMAIL PROTECTED]/[EMAIL PROTECTED] _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor