Skip to content

Adiciona artigo: Orientação a objetos de outra forma: Métodos estáticos e de classes #317

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 20, 2021

Conversation

eduardoklosowski
Copy link
Member

No description provided.


@staticmethod
def valida_nome(nome):
return len(nome) >= 3 and ' ' not in nome
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ficou bem complicado de entender para alguem que ainda está aprendendo python....

Assim talvez fique mais legivel para novatos:

    @staticmethod
    def valida_nome(nome):
        if len(nome) >= 3 and ' ' not in nome:
            return True
        return False

Dito isto, talvez é fora do escopo do teu texto, mas ficaria interessante a explicação da simplificação do codigo acima para

    @staticmethod
    def valida_nome(nome):
        return len(nome) >= 3 and ' ' not in nome

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Primeiramente, obrigado pelo feedback, infelizmente recebo bem poucos.

Porém eu acredito que um iniciante que conheça os tipos de variáveis conseguiria entender o código. Muito provavelmente se tivesse que fazer, um iniciante faria a versão com if como você demonstrou, mas estudando um pouco o código, acredito que conseguiria entender. E como essa implementação é um assunto totalmente secundário ao texto, dando para entendê-lo sem precisar entender essa implementação, optei por não descrevê-la, assim como alguns outros conceitos, visando ter um texto mais curto, e apresentando uma implementação que eu acredito ser o melhor código, do que um código mais simples de entender. E embora o conceito de orientação a objetos de a ideia de ser um artigo voltado para iniciantes, o assunto discutido acaba exigindo algum grau de conhecimento prévio.

@luzfcb luzfcb merged commit 588aef7 into pythonclub:pelican Apr 20, 2021
@luzfcb
Copy link
Member

luzfcb commented Apr 20, 2021

@eduardoklosowski obrigado novamente

@eduardoklosowski eduardoklosowski deleted the artigo branch April 20, 2021 19:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants