Skip to main content

Posts

Showing posts from January, 2016

Python classes and getattr

I banged my head on this all day, and it's really stupid because I didn't read documentation carefully. I had a python class where I put the @property decorator on some instance methods, and later on, I called getattr(some_obj, 'name_of_method')() and kept getting 'unicode' object is not callable So the problem was the @property decorator, it seems, because getattr() was getting the actual value of that some_obj.get_id() before invoking. I removed @property and bam, it worked... only like 3 hours later.