2016-02-17 19:59 GMT+01:00 Giuseppe Costanzi <giuseppecosta...@gmail.com>:
> args = ('Y','Y','Z') > kwargs = {1:"A", 2:"B", 3:"C"} > > foo = B(args, kwargs) > ok questo è praticamente un check della mia comprensione di questo meccanismo di python: nella chiama al costruttore di B stai passando due argomenti posizionali cioè args e kwargs che sono rispettivamente una tupla e un dict e il __init__ di B ha un primo parametro posizionale chiamato arg (che cattura la prima tupla) mentre mi pare di capire che tu volessi fare una cosa del tipo: foo = B(*args, **kwargs) cioè espandere la tupla args in parametri posizionali e il dict kwargs in parametri chiave valore, ho capito male? -- "Unix IS user friendly. It's just selective about who its friend are" "Nevertheless I still think it’s a bad idea to make things harder for ourselves if we can avoid it." "C is quirky, flawed, and an enormous success." -- Dennis Ritchie "Shipping is a feature. A really important feature. Your product must have it." "La gatta frettolosa ha fatto i gattini ciechi"
_______________________________________________ Python mailing list Python@lists.python.it http://lists.python.it/mailman/listinfo/python