Unbound methods - Python - Programmation
Marsh Posté le 08-09-2004 à 13:25:33
ben si tu mets self, c'est une méthode d'instance
sinon voir classmethod/staticmethod
Marsh Posté le 08-09-2004 à 13:28:12
Taz a écrit : ben si tu mets self, c'est une méthode d'instance |
Je sais, mais sans le self il me balance
Code :
|
Code :
|
Ok, j'essaierais de voir ce truc
Marsh Posté le 08-09-2004 à 13:36:50
2.3.4 pour le moment
tu pourrais m'en dire plus sur les décorators ou tu m'envoies dans les docs?
Marsh Posté le 08-09-2004 à 13:08:57
imaginons
faire un fb = foo() me permet d'appeler fb.bar()
Mais est-il possible d'appeler cette fonction par foo.bar() (donc sans l'avoir rattachée à une instance de foo)?
J'ai tenté sans paramètre self, sans succès, j'ai tenté en lui fournissant une instance de foo en paramètre self, mais elle l'utilise pour se binder...
---------------
I mean, true, a cancer will probably destroy its host organism. But what about the cells whose mutations allow them to think outside the box by throwing away the limits imposed by overbearing genetic regulations? Isn't that a good thing?