Fix Python – super() fails with error: TypeError “argument 1 must be type, not classobj” when parent does not inherit from object

I get some error that I can’t figure out. Any clue what is wrong with my sample code?
class B:
def meth(self, arg):
print arg

class C(B):
def meth(self, arg):
super(C, self).meth(arg)

print C().meth(1)

I got the sample test code from help of ‘super’ built-in method.
Here is the error:
Traceback (most recent call last):

Fix Python – How can I create an object and add attributes to it?

I want to create a dynamic object (inside another object) in Python and then add attributes to it.
I tried:
obj = someobject
obj.a = object()
setattr(obj.a, ‘somefield’, ‘somevalue’)

but this didn’t work.
Any ideas?
I am setting the attributes from a for loop which loops through a list of values, e.g.
params = [‘attr1’, ‘attr2’, ‘attr3’]

Fix Python – How to convert a nested Python dict to object?

I’m searching for an elegant way to get data using attribute access on a dict with some nested dicts and lists (i.e. javascript-style object syntax).
For example:
>>> d = {‘a’: 1, ‘b’: {‘c’: 2}, ‘d’: [“hi”, {‘foo’: “bar”}]}

Should be accessible in this way:
>>> x = dict2obj(d)
>>> x.a
>>> x.b.c
>>> x.d[1].foo

I think, this is not possibl….

Fix Python – How do I call a parent class’s method from a child class in Python?

When creating a simple object hierarchy in Python, I’d like to be able to invoke methods of the parent class from a derived class. In Perl and Java, there is a keyword for this (super). In Perl, I might do this:
package Foo;

sub frotz {
return “Bamf”;

package Bar;
@ISA = qw(Foo);

sub frotz {
my $str = SUPER::frotz();
return uc($st….