How to bypass a method in Python..?

This is the place for queries that don't fit in any of the other categories.

How to bypass a method in Python..?

Postby 9491731751 » Tue Sep 24, 2013 5:27 am

Here is the scenario.

I have a class(X) having method(xyz)

I have to define a class(Y) which extends class(X) but should run method(pqr) instead of method(xyz)

Here is the example :

Code: Select all
class X():
    def method(self):
        -----

class Y(X):
    def method(self):
        -----Actually, my requirement is to call "Y.method()" whenever "X.method()" is called and I can't do modifications in 'Class X' but I can modify 'Class Y'.


Could anyone please clarify this.
9491731751
 
Posts: 1
Joined: Tue Sep 24, 2013 5:21 am

Re: How to bypass a method in Python..?

Postby micseydel » Tue Sep 24, 2013 6:00 am

I don't believe what you want is possible in Python, and for good reason. If you can explain why you want this though, we can probably tell you a better way to do it.
Join the #python-forum IRC channel on irc.freenode.net!

Please do not PM members regarding questions which are meant to be discussed publicly. The point of the forum is so that others can benefit from it. We don't want to help you over PMs or emails.
User avatar
micseydel
 
Posts: 1229
Joined: Tue Feb 12, 2013 2:18 am
Location: Mountain View, CA


Return to General Coding Help

Who is online

Users browsing this forum: No registered users and 3 guests