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

reflection

hello there

I have searched the documentation in vein... :(

I would like to be able to

a) see all classes in the runing system

b) inspect all classse that can be found in pythonpath (to look for
classes not yet made instances of / loaded)
how to perform these simple tasks?

sincerely
Carlo
Jul 18 '05 #1
3 1852
carlo v. dango wrote:
hello there

I have searched the documentation in vein... :(
Well, then, I guess it's time to try an artery :-)
When I typed "python introspection" into Google, my first result was:

http://www-106.ibm.com/developerwork...y/l-pyint.html

which seems to be a nice introduction to the topic.

-Dan

I would like to be able to

a) see all classes in the runing system

b) inspect all classse that can be found in pythonpath (to look for
classes not yet made instances of / loaded)
how to perform these simple tasks?

sincerely
Carlo

Jul 18 '05 #2
"carlo v. dango" <da***@inc.com> wrote in news:77rbr1-
17*****@gatekeeper.kadnet.dk:
hello there

I have searched the documentation in vein... :(

I would like to be able to

a) see all classes in the runing system
New style classes:

def allclasses():
klasses = { }
work = [ object ]
while work:
aType = work.pop()
if aType not in klasses:
klasses[aType] = None
work.extend(type.__subclasses__(aType))
return klasses.keys()

print allclasses()

Or for all classes, new and old:

import gc, types
for o in gc.get_objects():
if type(o) in (type, types.ClassType):
print repr(o)

b) inspect all classse that can be found in pythonpath (to look for
classes not yet made instances of / loaded)
how to perform these simple tasks?

sincerely
Carlo


Jul 18 '05 #3
Duncan Booth wrote:

many thanks for the input..
"carlo v. dango" <da***@inc.com> wrote in news:77rbr1-
17*****@gatekeeper.kadnet.dk:

hello there

I have searched the documentation in vein... :(

I would like to be able to

a) see all classes in the runing system

New style classes:

def allclasses():
klasses = { }
work = [ object ]
while work:
aType = work.pop()
if aType not in klasses:
klasses[aType] = None
work.extend(type.__subclasses__(aType))
return klasses.keys()

print allclasses()

Or for all classes, new and old:

import gc, types
for o in gc.get_objects():
if type(o) in (type, types.ClassType):
print repr(o)

b) inspect all classse that can be found in pythonpath (to look for
classes not yet made instances of / loaded)
how to perform these simple tasks?

sincerely
Carlo



Jul 18 '05 #4

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

Similar topics

0
by: A. Wiebenga | last post by:
Hi all! I am a student at the Hogeschool van Arnhem en Nijmegen in Holland. I am currently involved in a research project regarding Reflection. Purpose of the research project is to document...
10
by: Sunny | last post by:
Hi, I have an old problem which I couldn't solve so far. Now I have found a post in that group that gave me an idea, but I can not fully understand it. The problem is: I'm trying to use a...
2
by: Jason Coyne Gaijin42 | last post by:
I have seen several people looking for a way to access the Columns collection when using the AutoGenerate = true option. Some people have gotten so far as to find the private autoGenColumnsArray...
2
by: Mark | last post by:
Am I out of my mind if I use Reflection everytime someone logs into our site to get and track the current Major/Minor/Build/Revision version that the person is viewing our site through? This...
0
by: Shawn Hogan | last post by:
Hi everyone, I've been trying to execute a control's private event code via reflection from another class with the goal of potentially doing some unit testing. The examples below are trying to...
3
by: HL | last post by:
The requirement is to send some information to other objects. The objects to whom the information has to be sent is not available at compile time. The names of the types (objects) will be provided...
9
by: Kuberan Naganathan | last post by:
Hello all Does anyone know of a good way to use reflection in c++? I don't mean simply using rtti or dynamic casting. I'm talking about java/c# style reflection where an actual instance of...
17
by: raylopez99 | last post by:
What good is C# Reflection, other than to find out what types are in an assembly? And to dynamically invoke methods in an assembly (.dll or .exe)? Also, bonus question, can you use Reflection...
0
by: Gustavo Arriola | last post by:
Hola a todos! Estoy intentando ejecutar un método usando Reflection. El código es el siguiente: public static void SoapHandler(Exception Error) { try { Type assemblyType;
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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.