python代码缩进是一种语法吗_Python缩进的代码风格真的很好吗?

Why Indentation Syntax?

The indentation rule may seem unusual at first glance to programmers accustomed to

C-like languages, but it is a deliberate feature of Python, and it’s one of the main ways

that Python almost forces programmers to produce uniform, regular, and readable code. It essentially means that you must line up your code vertically, in columns, ac-

cording to its logical structure. The net effect is to make your code more consistent and

readable (unlike much of the code written in C-like languages).

To put that more strongly, aligning your code according to its logical structure is a

major part of making it readable, and thus reusable and maintainable, by yourself and

others. In fact, even if you never use Python after reading this book, you should get into

the habit of aligning your code for readability in any block-structured language. Python

underscores the issue by making this a part of its syntax, but it’s an important thing to

do in any programming language, and it has a huge impact on the usefulness of your

code.

Your experience may vary, but when I was still doing development on a full-time basis,

I was mostly paid to work on large old C++ programs that had been worked on by

many programmers over the years. Almost invariably, each programmer had his or her

own style for indenting code.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值