[Tutor] Language truce

D-Man dsh8290@rit.edu
Thu, 28 Jun 2001 14:53:53 -0400


On Thu, Jun 28, 2001 at 11:04:43AM -0700, Michael Powe wrote:
| >>>>> "Israel" == Israel Evans <israel@lith.com> writes:
| 
|     Israel> What exactly IS the Python Programming Paradigm---(PPP) :)
|     Israel> ???
| 
|     Israel> Everything is Beautiful and Easy.
| 
|     Israel> Strolling Leisurely towards Nirvana?
| 
| Would that it were so.  
| 
| A couple things I mentioned, like you can't increment through loops.

There are 2 answers to this :

1)  you can,  ex

    i = 0
    while i < 10 :
        print i
        i += 1  # increment!!

2)  you don't need to, ex

    for i in range( 10 ) :
        print i

I really like the latter because i don't need to explain how to
iterate a certain number of time, it just works.

| But, also, it occurs to me that another part of the paradigm appears
| to be that you can't create new data types, aka structs in C.

Actually you can create as many data types as you want, and they are
better than structs in C.  Structs in C only hold _data_ together, no
operations.  The 'class' construct in Python allows you to define a
new data type that has both data and operations that can be performed
on the data.

See 
    http://www.python.org/doc/current/tut/node11.html
and
    http://www.crosswinds.net/~agauld/tutclass.htm
for more information.  Then feel free to ask any questions you have
regarding classes and OOP :-).

-D