As Simple As Possible?
Chuck Allison says: After three years of study, I have concluded that Python is about as simple as a full-powered object-oriented language can get. My inner programmer just loves it. In a recent interview Scott Meyers was asked which language he thought would be ideal for introducing programming to novices. He replied: "... a first language should foster a feeling of power and accomplishment out of the box - it should get people excited about the limitless things that can be accomplished in software. Among other things, such a language would offer an extensive and powerful library..." [1] I know of no language to which these words apply more than Python. LINK: http://www.artima.com/cppsource/simple.html -- http://mail.python.org/mailman/listinfo/python-list
Re: Inheritance problem ?
tooper wrote:
> Hello all,
>
> I'm trying to implement a common behavior for some object that can be
> read from a DB or (when out of network) from an XML extract of this DB.
> I've then wrote 2 classes, one reading from XML & the other from the
> DB, both inheritating from a common one where I want to implement
> several common methods.
> Doing this, I've come to some behaviour I can't explain to myself,
> which I've reproduced in the example bellow :
>
> -
>
> class myfather:
> def __repr__(self):
> return "\t a="+self.a+"\n\t b="+self.b
>
> class mychilda(myfather):
> def __init__(self,a):
> self.a= a
> def __getattr__(self,name):
> return "Undefined for mychilda"
>
> class mychildb(myfather):
> def __init__(self,b):
> self.b= b
> def __getattr__(self,name):
> return "Undefined for mychildb"
>
> a= mychilda("a")
> b= mychildb("b")
>
> print "a:\n"+str(a)
> print "b:\n"+str(b)
>
> -
>
> I was expecting to get :
>
> a:
>a= a
>b= Undefined for mychilda
> b:
>a= Undefined for mychildb
>b= b
>
> but I get the following error :
>
> File "/home/thierry/mytest.py", line 20, in ?
> print "a:\n"+str(a)
> TypeError: 'str' object is not callable
>
> Could someone explain me what I missed ?
>
> Thanks in advance !
hi I am got python 2.4 and changed "class myfather"
to new style classes "class myfather(object)" it worked.
here is the output :
a:
a=a
b=Undefined for mychilda
b:
a=Undefined for mychildb
b=b
But i myself still need explaination ;)
regards
jitu
--
http://mail.python.org/mailman/listinfo/python-list
Re: Inheritance problem ?
The stuff on Descriptor.htm was really good . Thanks -- http://mail.python.org/mailman/listinfo/python-list
Re: Programming newbie coming from Ruby: a few Python questions
[EMAIL PROTECTED] wrote: > Hi all. I've been try to learn ruby for a few months but I'm about > ready to give up. Perfection is achieved only on the point of collapse. -- C.N. Parkinson Welcome to Python , apart from the tutorials whenever time permits do read this articles . Why Python :http://www.linuxjournal.com/article/3882 The Python Paradox :http://www.paulgraham.com/pypar.html Why I Promote Python : http://www.prescod.net/python/why.html Regards Jitendra Nair Ensim India Pvt Ltd , Pune , India The available books either assume a programming > background, or are out of date. Anyway, I think python may suit me more > due to its 'theres one way to do it' philosophy (hope the quote is > right)! Another quote that I liked was: > > 'Clever is not considered a compliment in Python.' (don't know where I > read that...) > > In Ruby, there are many ways to do the same thing and cleverness seems > to be held in high regard. These attitudes are not too helpful for > beginners in my experience. Anyway, enough waffle. > > What books and tutorials are recommended to learn Python? The tutorial > that comes with Python is great and has given me a good overview but I > think I'd benefit from some programming projects, now I have a little > understanding of how Python works. > > Ideally, I'd like a whole series of projects where I'm walked through > how to go about writing real Python. The way I look at it, nobody > learnt to build a house just from reading about building materials! > > Any other tips for getting up to speed with Python fairly quickly will > be greatly appreciated. > > If anyone can help, thanks very much -- http://mail.python.org/mailman/listinfo/python-list
