>>>>> "Enrico" <4...@755189.45> (E) wrote:

>E> "lczancanella" <lczancane...@gmail.com> ha scritto nel messaggio
>E> news:32bf5ccb-5bfd-49a5-b423-9d41180a0...@l28g2000vba.googlegroups.com...
>>> 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):

>E> A quick look to your code suggests to me to rewrite the above lines as:

>E> class Funcoes:
>E>     @classmethod
>E>     def CifradorDeCesar(self, mensagem, chave, funcao):

>E> @classmethod is needed since you call:
>>> atribdescripto = Funcoes.CifradorDeCesar (atribcripto,
>E> 3, 2)

The method doesn't need the class at all, so a staticmethod would be
preferable:
class Funcoes:
    @staticmethod
    def CifradorDeCesar(self, mensagem, chave, funcao):

But as been mentioned in this thread before, there might be no reason to
use the class anyway.

The next thing you will run into is that you call CifradorDeCesar with
an int as parameter (mensagem) but it expects a string (or byte string,
at least something iterable).

-- 
Piet van Oostrum <p...@cs.uu.nl>
URL: http://pietvanoostrum.com [PGP 8DAE142BE17999C4]
Private email: p...@vanoostrum.org
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to