1

I have written a class which produces desired output when correct attributes (10 of them) are passed. Now, I am trying to pass lists of these attributes to the class, but getting an error.

Could anyone, please, give me a good example of passing a list (or lists) of attributes to a class (a class which has methods involving pow() and log() functions)?

Thank you in advance. Cheers

  • Post your current code, what you've tried, and the error message. – tzaman Jul 18 '17 at 16:37
  • 1
    look at [`*args`](https://pythontips.com/2013/08/04/args-and-kwargs-in-python-explained/) – gionni Jul 18 '17 at 16:39
  • Unfortunately, can't post the code (confidentiality issues with the math functions in it). It's going to take me a while to write a similar code. I feel like I am missing something really simple. Therefore, asked for a good example. – Ali Abbasov Jul 18 '17 at 16:41
  • @gionni, Thanks a lot, mate :) – Ali Abbasov Jul 18 '17 at 16:54
  • 1
    maybe something like `def __init__(self, **kwargs)` so you can pass a dict of attributes when initializing your class instance (look at [**kwargs](https://stackoverflow.com/questions/3394835/args-and-kwargs#3394898)) – mquantin Jul 18 '17 at 17:09

0 Answers0