initialization - Python decorator for automatic binding __init__ arguments -


is there way automatically bind self (some of) arguments of __init__ method?

i mean like:

class person:     @lazy_init     def __init__(self, name, age, address):         ... 

... instead of:

class person:     def __init__(self, name, age, address):         self.name = name         self.age = age         self.address = address         ... 

i wonder if there similar people use in such cases. or there reason i'm not supposed way in first place?

http://code.activestate.com/recipes/551763-automatic-attribute-assignment/ you're looking for.

also see what best way automatic attribute assignment in python, , idea?


Comments

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -