On Fri, Sep 24, 2010 at 1:43 AM, Roelof Wobben <rwob...@hotmail.com> wrote: > > > > ---------------------------------------- >> From: st...@pearwood.info >> To: tutor@python.org >> Date: Fri, 24 Sep 2010 13:00:40 +1000 >> Subject: Re: [Tutor] pure function problem >> >> Roelof, please learn to delete unnecessarily quoted text. There's no >> need to quoted the entire discussion every time you answer. >> >> On Fri, 24 Sep 2010 06:20:25 am Roelof Wobben wrote: >> >>> time = tijd() >> [...] >>> print time(uitkomst) >> >> Why are you calling time as a function, when it is a tijd instance? >> >> >> >> >> -- >> Steven D'Aprano >> _______________________________________________ >> Tutor maillist - Tutor@python.org >> To unsubscribe or change subscription options: >> http://mail.python.org/mailman/listinfo/tutor > > > Hello Steve, > > I found this in my tutorial. > > 13.8. Instances as return values¶ > Functions can return instances. For example, find_center takes a Rectangle as > an argument and returns a Point that contains the coordinates of the center > of the Rectangle: > def find_center(box): > p = Point() > p.x = box.corner.x + box.width/2.0 > p.y = box.corner.y - box.height/2.0 > return p > To call this function, pass box as an argument and assign the result to a > variable: >>>> center = find_center(box) >>>> print_point(center) > (50.0, 100.0) > > > So i followed it but appearently not the good way. > > Roelof > > _______________________________________________ > Tutor maillist - tu...@python.org > To unsubscribe or change subscription options: > http://mail.python.org/mailman/listinfo/tutor > If I'm understanding the question correctly(I skim alot) It looks like you're trying to use a class like a function.
If you had: class tijd(object): def bob: pass then you would call bob from the class in an instance like this: aclass = tijd() calledClassFunction = aclass.bob but if you have aclass = tijd() calledClassFunction = aclass.notbob then you can't access it, because notbob is not in tijd(), therefore not in aclass, which is still the same as being tijd().bob, you just have to call the class instance before the function can be accessed. _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor