Python and Schools

Harald Massa cpl.19.ghum at spamgourmet.com
Sat Apr 12 05:48:06 EDT 2003


Mads,

>Harald Massa wrote:
 
>> Yes, I love Python, and it is the most elegant programming language I
>> ever met.

> Mad wrote:
> all the self me here and self me there is - to me at last - exceedingly 
> clumsy and a constant source of frustration. 

Mad, I wrote that I love Python. Not: Python is perfect.

Especially if you look at OO: OO with Python is great. Adding/Removing 
Attributes on the fly, inspecting objects in the living system, getting 
documentation while running....

And then there is the self. It is not bad. It does not hurt your OO 
programming. It's like the nipples of a beautifull girl turning into a 
different color during intercourse. You think it's wired for the first 
time. You wonder, why is this necessary.

But sex with her is perfect. She is beautifull. She knows to dress and to 
behave with your geeky friends and with your business friends, handles 
situation in gym as well as in the opera. 
There is only that strange colour her nipples are turning when she's 
nearing orgasm.

And this strange colour of her nipples is like Pythons "self": it takes 
time to love it. 

It's not that great astonishing for var in iterator: do something. It's 
not the perfect ass of the girl, with that you fall in love immediately.

It's the strange colour the nipples turn during sex. But after some time 
you learn to love this colour ... you see this colour and know: she is 
hot.

Same happened to Python, self and me: Someday I recognized, that for 
nested classes self is a godsend: you can access the outerclass self with 
total ease, just name it differently:

class miriam:
    def __init__(self, numberofshoes):
        self.shoes=numberofshoes
    def goshopping(self):
        class necessaryitems:
            def __init__(innerself):
                if self.shoes > 10:
                    innerself.ni=["wine","grapes","cheese"]
                else:
                    innerself.ni=["shoes","wine","strawberrys"]
            def shoppinglist(innerself):
                for a in innerself.ni:
                    print a
        myneci=necessaryitems()
        myneci.shoppinglist()

a=miriam(8)
a.goshopping()

Doing similiar accesses without "SELF" is a real pain in the ass. It's 
like finding out what tearns a girl on without the colourchanging 
nipples. Once you learned to love it, you never will stop your loving.

best self-wishes

Harald
    	    	    	




More information about the Python-list mailing list