473,322 Members | 1,496 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,322 software developers and data experts.

Re: find an object ancestor

Thanks it works OK

On Thu, 2008-11-06 at 13:14 +1000, James Mills wrote:
On Mon, Nov 3, 2008 at 7:16 AM, Michel Perez <op****@infomed.sld.cu>
wrote:
HI all:

imagine something like this:

class father:
pass
class son( father ):
pass

I need to know the son ancestor class how can i know this.
>class Father(object): pass
...
>class Son(Father): pass
...
>son = Son()
isinstance(son, Father)
True
>isinstance(son, Son)
True
>son.__class__.__bases__
(<class '__main__.Father'>,)
>>

--JamesMills

---------------------------------------
Red Telematica de Salud - Cuba
CNICM - Infomed
Nov 6 '08 #1
0 1291

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

Similar topics

4
by: lkrubner | last post by:
I'm reading an essay, I think one of Crockford's, and it has this example in it: function Demo() { } Demo.prototype = new Ancestor(); Demo.prototype.foo = function () { } ; Does Ancestor now...
2
by: Raed Sawalha | last post by:
I have following XML: How can I find the depth of XML? in other word max level of the XML <Root> ----- level 0 <Name>----- level 1 <FirstName>name</FirstName> ---- level 2...
3
by: Jack Addington | last post by:
Is there a quick and easy way in Visual Studio 2003 to get the method declaration from the ancestor so I can override/extend it? I know that if I am in another method or the constructor and type...
15
by: mr.peteryu | last post by:
Hi, Can someone explain the idea behind casting to an interface? For example: -> I have an IInterface that contains a Read() method. -> I have an object "obj" that implements IInterface. ...
11
by: John Bailo | last post by:
Is anyone familar with the correct syntax for using ancestor:: ? I am trying to use it in a c# application, and I am also testing it in a parser application called Cooktop (...
3
by: Luis P. Mendes | last post by:
Hi, I have the following problem: I instantiate class Sistema from another class. The result is the same if I import it to interactive shell. s = Sistema("par") class Sistema:
5
by: jm.suresh | last post by:
Hi I have three objects, all of them are instances of classes derived from a base class. Now, given one of the instance, I want to find the closest relative of the other two. How can I do this? ...
5
by: gnewsgroup | last post by:
In my user control, I would like to find a Label control in the parent page (the page that uses my user control). I need to update that Label.Text when something happens in the user control. I...
6
by: kishjeff | last post by:
Hi. Can someone tell me how to find all the elements of type 'table' which have an attribute named 'source' and are not descendents of 'querybox' ? I'm sort of wrestling with it and am hoping...
0
by: James Mills | last post by:
On Mon, Nov 3, 2008 at 7:16 AM, Michel Perez <opsbat@infomed.sld.cuwrote: .... .... True True (<class '__main__.Father'>,) --JamesMills
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.