simple loop question

47 views
Skip to first unread message

Alex Glaros

unread,
Mar 22, 2013, 6:51:01 PM3/22/13
to web...@googlegroups.com
I'm trying to write a simple loop in default.py.  What's wrong with this below?  Thanks, Alex Glaros

def new2():
    y=5
    while y > 0:
        response.write='<P>howdy</P>'
        y=y-1
    pass   

Anthony

unread,
Mar 22, 2013, 11:46:47 PM3/22/13
to web...@googlegroups.com
response.write() is a method, not an attribute (even if it were an attribute, you would be overwriting it repeatedly, not appending to it).

Anthony

Alex Glaros

unread,
Mar 23, 2013, 10:37:06 AM3/23/13
to web...@googlegroups.com
Anthony,

Can you recommend any online tutorials or videos to help someone that doesn't know object oriented programming?

Hopefully something that can be related to web2py so that I would learn that response.write() is a method, not an attribute.

I just started writing an app without knowing oop and don't know how "method" relates to web2py MV or C.

thanks,

Alex

greaneym

unread,
Mar 23, 2013, 3:15:02 PM3/23/13
to web...@googlegroups.com
 Hi Alex,

www.programr.com 
has python object-oriented examples

www.coursera.org  has a python course in April.

The mvc approach can be learned by trying the examples in web2py's on-line manual, using the welcome app that comes with the install.  Trying examples yourself is a great way to
learn web2py.

Margaret
Reply all
Reply to author
Forward
0 new messages