How to test if an object IS another object?

2005-06-12 Thread dan . eloff
If two objects are of equal value you can compare them with ==. What I want to do is find out if two objects are actually just references to the same object, how can I do this in Python? Thanks -- http://mail.python.org/mailman/listinfo/python-list

Re: How Do I get Know What Attributes/Functions In A Class?

2005-02-23 Thread Dan Eloff
Use the dir() function dir(myClass) returns a list of strings -Dan -- http://mail.python.org/mailman/listinfo/python-list

Re: Dynamically pass a function arguments from a dict

2005-02-23 Thread Dan Eloff
Awesome, wrapping that into a function: def getargs(func): numArgs = func.func_code.co_argcount names = func.func_code.co_varnames return names[:numArgs] short, concise, and it works :) variables declared inside the function body are also in co_varnames but after the arguments only it s

Dynamically pass a function arguments from a dict

2005-02-23 Thread Dan Eloff
You can take a dictionary of key/value pairs and pass it to a function as keyword arguments: def func(foo,bar): print foo, bar args = {'foo':1, 'bar':2} func(**args) will print "1 2" But what if you try passing those arguments to a function def func2(bar,zoo=''): print bar, zoo H