calling a class instance of function

Pyenos pyenos at pyenos.org
Wed Dec 20 19:09:32 EST 2006


class pid:
    "pid"
    def add(original_pid,toadd):
        "add pid"
        original_pid.append(toadd)
        return original_pid
    def remove(something_to_remove_from,what):
        "remove pid"
        something_to_remove_from.remove(what)
        return something_to_remove_from
    def modify(source,element,changewiththis):
        "modify pid"
        source[source.index(element)]=changewiththis
        return source

class test(pid):
    pid.original=[1,2,3]
    pid.toadd=4
    pid.add(pid.original,pid.toadd) # error here says that
                                    # it expects pid instance as first arg
                                    # not a list that it got.

why do i get an error?



More information about the Python-list mailing list