Unbound Method Error

Scott David Daniels Scott.Daniels at Acm.Org
Tue Jun 9 17:19:13 CEST 2009


lczancanella wrote:
> Hi, i am brand new in Python, so sorry if this question is too basic,
> but i have tried a lot and dont have success... I have the following
> code...
> 
> class Funcoes:
>     def CifradorDeCesar(mensagem, chave, funcao):
>         ...
> 

You've gotten some "interesting" advice.

You want one of:

     class Funcoes:
         @staticmethod
         def CifradorDeCesar(mensagem, chave, funcao):
             ...
or:
     class Funcoes:
         def CifradorDeCesar(self, mensagem, chave, funcao):
             ...
or:
     class Funcoes:
         @class_method
         def CifradorDeCesar(class_, mensagem, chave, funcao):
             ...

--Scott David Daniels
Scott.Daniels at Acm.Org



More information about the Python-list mailing list