How to pass objects to a function?

Shankar SNeelakantan_C at zaplet.com
Fri Nov 2 02:23:47 CET 2001


I am a python newbie.

How do I  pass a user defined object to a function?

if I have something like

def func(session, url):
        ...
        ....

and session is supposed to be an object of httpsession class, how
would the interpreter know about it? I suppose all arguments are
treated as strings.
so, if I invoke a method such as session.getreply() or something I
would get an error. The httpsession class is expected to have derived
classes too.
(that should not matter to the problem in hand anyway).

Also, if anybody has used the httplib.py module, can someone tell me
how to do a request.redirect() if the replycode is 302.

Kindly let me know ASAP.

Thanks,
Shanker



More information about the Python-list mailing list