Coder Social home page Coder Social logo

cleancode's Introduction

클린코드

파이썬은 PEP-8을 따라 코딩을 해야한다.

예를들어 location=current_location, location = get_location()과 같이 키워드인자는 띄어쓰기를 하지 않고 변수는 띄어쓰기를 한다. 이렇게 검색 효율성을 위해 띄어쓰기를 구분해서 사용해야 한다.

Docstring과 어노테이션

코드를 문서화하는 것은 주석과는 다르다. 주석은 가급적 피해야한다. docstring은 소스코드에 포함된 문서이다. docstring은 이유가 아니라 설명이다. docstring을 코드에 포함시기는것이 좋은 이유는 파이썬이 동적 타이핑을 하기 때문이다. 예를들어 함수는 파라미터 값으로 무엇이든 사용할 수 있다. 파이썬은 파라미터의 타입을 체크하거나 강요하지 않는다.

어노테이션의 기본 아이디어는 코드 사용자에게 함수 인자로 어떤 값이 와야하는지, 함수 반환값에 대한 예상 타입을 지정할 수도 있다. 타입힌팅 검사를 도화주는 Mypy를 사용할 수도 있다.

cleancode's People

Contributors

jjungeun avatar

Stargazers

Roman avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.