[Tutor] Python decorator to ensure that kwargs are correct

2009-09-18 Thread Manuel de la Pena
Hello, I have done a decorator that I used to ensure that the keyword arguments passed to a constructor are the correct/expected ones. The code is the following: from functools import wraps def keyargs_check(keywords): This decorator ensures that the keys passed in kwargs are the onces that

Re: [Tutor] Python decorator to ensure that kwargs are correct

2009-09-18 Thread Rich Lovely
2009/9/18 Manuel de la Pena man...@themacaque.com: Hello, I have done a decorator that I used to ensure that the keyword arguments passed to a constructor are the correct/expected ones. The code is the following: from functools import wraps def keyargs_check(keywords): This decorator

Re: [Tutor] Python decorator to ensure that kwargs are correct

2009-09-18 Thread Rich Lovely
Should probably clean up my code properly before submitting, to hide some of the noobish errors like forgetting to put quotes round strings... class Demo(object): ... def __init__(self, name=, surname=, age=0): ... print name, surname, age ... Demo(name='Rich',