473,386 Members | 1,873 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

overwrite private method... (of wxColumnSorterMixin class)

Is there a posibility to overwrite a private method (one that starts with
__ ) ? I read that they are just formely private, they are prefixed with the
class name to have an obtured visibility, so maybe it's a trick here...

More details...
I use wxPython, more specifically the wxColumnSorterMixin class. I want to
overwrite the __OnColClick event handler to behave on my way: I want the
sorting feature will affect only some columns, not all columns and that
event handler is the key. The problem is that the event chain is skiped in
the __OnColClick method, so I cannot receive the event anymore. So, my idea
was to overwrite the __OnColClick method in the mixin subclass. Is this
possible? Or, are they other solutions for this ?

Thanks,
Florian.
Jul 18 '05 #1
2 2082

"Florian Preknya" <bo**@coco.ro> wrote in message
news:bu**********@nebula.dnttm.ro...
Is there a posibility to overwrite a private method (one that starts with
__ ) ? I read that they are just formely private, they are prefixed with the class name to have an obtured visibility, so maybe it's a trick here...

More details...
I use wxPython, more specifically the wxColumnSorterMixin class. I want to
overwrite the __OnColClick event handler to behave on my way: I want the
sorting feature will affect only some columns, not all columns and that
event handler is the key. The problem is that the event chain is skiped in
the __OnColClick method, so I cannot receive the event anymore. So, my idea was to overwrite the __OnColClick method in the mixin subclass. Is this
possible? Or, are they other solutions for this ?

Thanks,
Florian.

What you read is true, so far as I know. It is possible to override them,
as Python doesn't have a notion of encapsulation, again, as far as I know.
You can probably get away with this.
Jul 18 '05 #2
On Mon, Jan 19, 2004 at 05:00:03AM -0800, Zachary wrote:

"Florian Preknya" <bo**@coco.ro> wrote in message
news:bu**********@nebula.dnttm.ro...
Is there a posibility to overwrite a private method (one that starts with
__ ) ? I read that they are just formely private, they are prefixed with

the
class name to have an obtured visibility, so maybe it's a trick here...

More details...
I use wxPython, more specifically the wxColumnSorterMixin class. I want to
overwrite the __OnColClick event handler to behave on my way: I want the
sorting feature will affect only some columns, not all columns and that
event handler is the key. The problem is that the event chain is skiped in
the __OnColClick method, so I cannot receive the event anymore. So, my

idea
was to overwrite the __OnColClick method in the mixin subclass. Is this
possible? Or, are they other solutions for this ?

Thanks,
Florian.

What you read is true, so far as I know. It is possible to override them,
as Python doesn't have a notion of encapsulation, again, as far as I know.
You can probably get away with this.


Encapsulation is not the same thing as data hiding or private
attributes/methods. Python does not have private attributes or methods, so
this is possible. Python *does* support the concept of encapsulation, but
that is mostly unrelated to the question at hand.

class CustomColumnSorter(wxColumnSorterMixin):
def _wxColumnSorterMixin__OnColClick(...):
...

Assuming wxColumnSorterMixin is subclassable, this will work. It may not
be, though. There is also probably a better way to achieve the results
you're looking for. Perhaps by specifying a callback in some other way,
such as binding a handler to an event.

Jp

Jul 18 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: jcteague | last post by:
I have a class that has a set<int> member variable. the items in the set are selected indices of a vector. I would like to sort the set on the values in the vector they point too. Here is a part...
14
by: ericellsworth | last post by:
Hi, I'm trying to use a class to pass variables back and forth from a form opened in dialog mode. I have created a class which invokes a form in its show method, like so: Public Sub Show() '...
4
by: ewolfman | last post by:
Hi, I'm trying to retrieve a private method using reflection, which exists in my ASP.NET Page. It works only if I change the method's accessor to 'protected'. BTW: this occurs only for Page's...
7
by: Charles Law | last post by:
Sorry, but I am on a bit of a roll today. I have just found that I can make a method private to my class, but then use AddHandler in an external class to hook it up. Is that what people would...
7
by: Alex Vinokur | last post by:
I tried to build program with partial implementation. However a linker generates errors. Is there any approach that enables to use partial implementation for similar purposes? ------ foo.cpp...
4
by: rognon | last post by:
Hi there, I'm trying to do something, but I don't know if it's possible. Basically, I want to have a public static class method that could access a private object's method. I would like to be able...
8
by: David Veeneman | last post by:
Should a member variable be passed to a private method in the same class as a method argument, or should the method simply call the member variable? For years, I have passed member variables to...
6
Xx r3negade
by: Xx r3negade | last post by:
Consider this: I have the class foo, with the public method thread(), and the private method bar() In the thread() method, I would like to create a new thread, using pthread_create(), that...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.