Questions tagged [introspection]

A capability of some object-oriented programming languages to determine the type of an object at runtime.

Some OOP languages providing Type Introspection ability : Ruby, Objective-C, C++, Java, PHP, Perl, Python, Object Pascal, Actionscript (as3)

The introspection is done differently, depending on the form of program, it is performed upon: inspecting a source code or compiled byte-code is called compile-time introspection, while inspecting properties of running code is a run-time introspection.

For example, Java supports both types of introspection: users of run-time introspection typically perform it via , while compile-time introspection can be implemented with tools or .

http://en.wikipedia.org/wiki/Type_introspection

1021 questions
0
votes
1 answer

Collect class hierarchy of Flex application

I was wondering: If I have built a Flex application, is it possible to somehow collect it's class hierarchy using reflection or some other method? For example if I have defined components: CustomButton which derives from Button and RedCustomButton…
user1305056
0
votes
1 answer

django - Generate a dajaxice function that validates forms (dajaxice_register issue)

I'd like to make a generic function to validate modelforms in real time with dajaxice. Here is what i did : exafeeds/ajax.py from django.core.exceptions import ValidationError from django.utils import simplejson …
Antoine Pinsard
  • 33,148
  • 8
  • 67
  • 87
0
votes
2 answers

Is there any way to programmatically "move" an oracle table definition from one database to another?

Suppose I have two Oracle databases. We'll call them database A and database B. Now suppose I have a table in database A that's defined like this: CREATE TABLE foo ( foo_id INT PRIMARY KEY, some_text VARCHAR2(10), other_table_id INT …
Jason Baker
  • 192,085
  • 135
  • 376
  • 510
0
votes
1 answer

Is it possible to introspect actual attributes/methods of an object which overrides `__dir__` and `__getattribute__`?

Some answers from this question bring very silly ways to cripple the ability to access methods and attributes for instances of objects overriding __dir__ and __getattribute__. The attributes and methods are still there, but are they really…
Paulo Scardine
  • 73,447
  • 11
  • 124
  • 153
0
votes
2 answers

Define field in ndb using strings

This is my code: class SocialNodeSubscription(model.Model): def __init__(self, *args, **kwargs): permissions=["post","read","reply","admin"] for p in permissions: self.__dict__["can_"+p]=model.BooleanProperty(default=True) I…
Chobeat
  • 3,445
  • 6
  • 41
  • 59
0
votes
1 answer

object mapping using introspection restkit

I'm trying to parse a SOAP response using RestKit. I'm able to successfully convert the SOAP XML response into objects if I define the mappings and relationships myself. But, I was wondering if it's possible to use introspection (or something else)…
pshah
  • 2,052
  • 1
  • 21
  • 40
0
votes
2 answers

Why isn't my NSMutableArray of type NSMutableArray?

I got an NSMutableArray, created like this: NSMutableArray *expr = [[NSMutableArray alloc] init]; [expr addObject:[NSNumber numberWithDouble:3.0]]; [expr addObject:@"+"]; [expr addObject:@"%x"]; [expr addObject:@"*"]; [expr…
11684
  • 7,356
  • 12
  • 48
  • 71
0
votes
2 answers

How can A.f defined in module A get list of function defined in B if A.f was called from B

Let's say I have B.py import A def F(): pass def G(): pass if __name__ == '__main__': A.f() And when I run it I would like A.f to output list of functions defined in B.py like this ./B.py ['F', 'G'] The question is what should I…
alexanderkuk
  • 1,551
  • 2
  • 12
  • 29
0
votes
1 answer

Python reverse introspection

Lets suppose this example: Two siblings classes where one loads the other class as a new attribute and then i wish to use this attribute from the main class inside the sibling. a = 2 class AN(object): def __init__(self,a): self.aplus = a…
AndreLobato
  • 170
  • 1
  • 12
0
votes
2 answers

How to getDefinitionByName of a packageless class in AS3?

Say you have a flexunit test that looks like this: package foo { import flexunit.framework.TestCase; import flash.utils.getDefinitionByName; import flash.utils.getQualifiedSuperclassName; class DescribeTypeTest { public…
user123885
-1
votes
1 answer

Loop through module and run inspect.getdoc() on each method

I can print a list of all the builtins: for i, b in __builtins__.__dict__: print(i, b) __name__ __doc__ __package__ __loader__ __spec__ __build_class__ __import__ abs all any ascii ... Then import inspect and…
MikeiLL
  • 6,282
  • 5
  • 37
  • 68
-1
votes
1 answer

How to list fields of a node and dump it's data? GraphQL introspection

I was able to get the usernames like this: query { allUsers { edges { node { username } } } } But when I tried the same for the xxx node like this: query { allUsers { edges { node { xxx } …
-1
votes
1 answer

How to get a list of a Python class' variables with their docstring documentation

How can I get a list of class member variables and their docstring description from a Python class or dataclass? I have this dataclass @dataclass class MyDataClass(BaseDataClass): """ :param var1: Description for var1 :param var2:…
RaamEE
  • 3,017
  • 4
  • 33
  • 53
-1
votes
1 answer

How to access the variables created within a `with` statement

I have defined a python context class and a Test class in a file: class Test(object): pass class MyContext(object): def __init(self): self._vars = [] def __enter__(self): pass def __exit(self, ....): pass In another file using…
Paul Ochon
  • 11
  • 1
-1
votes
2 answers

If you don't trust global variables, when you are inside of a method, how do you tell what class we are currently in?

This is a question about the general principle of introspection. When you are inside of a method, how can we make it possible to tell what class we are currently in? We want something like as follows: class FigNewton: def baz(self): …
Toothpick Anemone
  • 4,290
  • 2
  • 20
  • 42