Unbound Method Error

Chris Rebert clp2 at rebertia.com
Tue Jun 9 19:27:57 CEST 2009


On Tue, Jun 9, 2009 at 8:19 AM, Scott David
Daniels<Scott.Daniels at acm.org> wrote:
> 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

There's no underscore in "classmethod" last time I checked.

>        def CifradorDeCesar(class_, mensagem, chave, funcao):
>            ...

You forgot one more option (the preferred one, IMHO):

#module toplevel
def CifradorDeCesar(mensagem, chave, funcao):


Cheers,
Chris
-- 
http://blog.rebertia.com



More information about the Python-list mailing list