Defining a constructor for ponyorm's Entities results in TypeError <p>i just wanted to try out the pony orm mapper for a small personal web application. Everything works fine except for defining a custom constructor for an entity.</p> <p>In the following code i created a simple entity with a string field <code>name</code> and defined a constructor which does nothing but redirect the arguments to the parent constructor (in my real app i change some of the arguments bevor passing them to the parent constructor). After that i create one <code>User</code> and print its name.</p> <pre><code>from pony.orm import Database, Required, db_session, commit db = Database("sqlite", ":memory:", create_db=True) class User(db.Entity): def __init__(self, *args, **kwargs): super(User, self).__init__(*args, **kwargs) name = Required(str) db.generate_mapping(create_tables=True) with db_session: u = User(name="Admin") commit() print(u, u.name) </code></pre> <p>The error message is <code>TypeError: object.__init__() takes no parameters</code> in the same line as the <code>super()</code>call. It looks like the keyword arguments are sent to <code>object</code> instead of <code>db.Entity</code>. When i remove the constructor everything works</p> <p>So why doesn't it work. Shouldn't a constructor like the one in my example just always work (and do nothing of course)? Is there something in ponyorm that prevents it from working or am i missing something here?</p> <p>For completeness sake my entity definition actually looks like this</p> <pre><code>class User(db.Entity): def __init__(self, *args, **kwargs): if "password" not in kwargs: raise ValueError("password is required") kwargs["password"] = werkzeug.security.generate_password_hash(kwargs["password"]) super().__init__(*args, **kwargs) name = Required(str) password = Required(str) </code></pre> <p>It produces the same results.</p> <p>Also in the official documentation it says that method creation in entities is allowed at least. <a href="http://doc.ponyorm.com/entities.html#adding-custom-methods-to-entities" rel="nofollow">http://doc.ponyorm.com/entities.html#adding-custom-methods-to-entities</a> . But it doesn't say anything about constructors.</p>