python的块注释_为什么在Python中没有块注释?

news/2025/5/29 17:29:06

1586010002-jmsa.png

I''m still tyring to figure out what "Pythonic" means, and I have a

feeling the answer to my question may fall into that category. Are block

comments somehow unpythonic?

解决方案John Salerno wrote:

I''m still tyring to figure out what "Pythonic" means, and I have a

feeling the answer to my question may fall into that category. Are block

comments somehow unpythonic?

only in the sense that python don''t have them.

but they''re pretty pointless, if you have a modern editor.

(and if you don''t, you can quickly comment out regions by putting them

inside a triple-quoted string.)

Fredrik Lundh wrote:you can quickly comment out regions by putting them

inside a triple-quoted string.)

Except that triple-quotes don''t nest.

I do agree, however, with the idea that any decent editor should be

able to comment out a block of code faster than I can type this

sentence.

It''s clear that if you have a modern editor, block comments are

unnecessary because it is trivial to add a # to the start of each line

of a block, but that doesn''t really answer your question. It explains

why you might not always need block comments but doesn''t explain why

you shouldn''t use them (especially in a primitive editor).

The danger with block comments is that there is no way to tell that the

code you''re looking at has been commented out unless you can see the

start or end of the comment block. If you have a modern editor, it

probably changes the color of all commented out code to eliminate

confusion. But if you have a primitive editor it does not. Also, even

people who use modern editors sometimes browse source code using a

plain text viewer (less/more).

Eliminating block comments eliminates uncertainty. :)

文章来源:https://blog.csdn.net/weixin_39640090/article/details/110190755
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:https://dhexx.cn/news/show-16763.html

相关文章

同步对象 Semaphore

semaphore: 保证指定个数的并发线程可以访问临界区。 而 lock/mutex&#xff1a;保证只有一个线程可以访问临界区&#xff08;被lock住的&#xff09;的资源或者代码。 namespace MutiThread {/// <summary>/// .net 信号量Semaphore的使用/// </summary>class Pr…

linux添加驱动模块,Linux驱动模块添加

一、Makefileifeq ($(KERNELRELEASE),)// 内核路径#KERNELDIR ? /home/lht/kernel2.6/linux-2.6.14KERNELDIR ? /lib/modules/$(shell uname -r)/buildPWD : $(shell pwd)modules:$(MAKE) -C $(KERNELDIR) M$(PWD) modulesmodules_install:$(MAKE) -C $(KERNELDIR) M$(PWD) m…

标准传输率和总线带宽_工业交换机的背板带宽

工业交换机的背板带宽&#xff0c;是工业交换机插口CPU或接口卡和系统总线间能够吞吐量的较大信息量。背板带宽标示了工业交换机总的数据传输工作能力&#xff0c;单位为Gbps&#xff0c;也叫互换网络带宽&#xff0c;一般的工业交换机的背板带宽从几Gbps到几百Gbps不一。一台工…

mac搭建php开发环境(mac+apache+mysql+php)并且安装zend framework1框架

本人电脑环境&#xff1a;mac 10.09 一、 mac电脑自带了apache&#xff0c;就不高兴重新安装了 简单的说下apache的三个命令 sudo apachectl start 开启 sudo apachectl restart 重启 sudo apachectl stop 停止 查看本机apache的版本为&#xff1a; sudo apach…

异步消息处理机制-Android中Handler原理(续)

异步消息处理线程是指线程启动后会进入一个无限循环&#xff0c;每循环一次&#xff0c;从内部的消息队列里面取出一个消息&#xff0c;并回调相应的消息处理函数。一般在任务常驻&#xff0c;比如用户交互任务的情况下使用异步消息处理线程。 之前在Android中Handler原理里面研…

linux 命令管道及重定向,Linux多命令协作:管道及重定向

Java中的递归运算Java中的递归运算是一种在自己的方法内部调用自己的方法 递归的设计思想是:把一个复杂的问题,分解为若干个等同的子问题,重复执行,直到之问题能够简单到直接求解,这样复杂的问题就得以解决. 递归运算有两 ...IIS网站服务器性能优化指南&lpar;转载&rpar…

服务器千兆网卡接百兆交换机不通_关于赫斯曼工业交换机光模块的测试,以失败告终...

最近某工程甲购了赫斯曼RS30-0802O6O6SDAEHC&#xff0c;并且配备了SFP光模块&#xff0c;说是用的多模光缆&#xff0c;从参数可以看出6A1a是50/125μm的多模光缆&#xff0c;因此配备的尾纤和光纤跳线也是同型号的产品。赫斯曼自控用多模光缆GYXTW-6a1A光缆GYXTW-6a1A光缆&am…

输入法之模型剪枝一(基于熵的剪枝)

prunning&#xff0c;剪枝&#xff0c;顾名思义就是减掉那些不重要的。从理论上来讲&#xff0c;剪枝达到的效果就是剪枝后的q和剪枝前的 p 最大化相似&#xff0c;有两种算法 entroy-based以及rank-based。针对model&#xff0c;使用相对熵来刻画D(q||p) 来刻画&#xff0c;保…

linux+shell+shuf,【shell】shuf命令,随机排序

react学习小结&lpar;生命周期- 实例化时期 - 存在期- 销毁时期&rpar;react学习小结 本文是我学习react的阶段性小结,如果看官你是react资深玩家,那么还请就此打住移步他处,如果你想给一些建议和指导,那么还请轻拍~ 目前团队内对react的使用非常普遍,之 ...创建如下三…

Java异常,配置log4j

注意: 1.Java中的所有异常都是由Throwable类的子类生成的对象&#xff0c;所有的异常类都是Throwable类的子类或子类的子类。Throwable类是Object类的直接子类&#xff0c;Error类和Exception类是Throwable类的两个直接子类。 Error 错误类 java.lang.Error 错误类一般是指虚拟…