Entries from 2014-08-09 to 1 day

I want to cast a parental object to a child object in Python.

Because there is no way to cast a object in Python, I make a method which do new a child class and copy values from a parental object.usage # cast method def cast(child_class, parental_obj): child_obj = child_class() for attr_name in paren…

Python でクラスキャスト

child_object.__class__ = ParentalClass