是否需要延续线? [英] Are line continuations needed?

查看:69
本文介绍了是否需要延续线?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,


Python允许您在多个
物理线路上继续使用单条逻辑线路,方法是在最后放置一个\或者让它发生

自动使用不完整的中缀操作符。


我想知道这个功能需要多长时间?如果它不是语言的一部分,会不会有任何问题?


-

" Sore wa himitsu desu。

要通过电子邮件回复,请从地址中删除

小点心。
http://www.esatclear.ie/~rwallace

解决方案

Russell Wallace写道:

大家好,

Python让你可以在一条以上的物理线上继续一条逻辑线,或者通过放置一个\\ \\最后或让它发生
自动与一个不完整的中缀操作员。

我想知道这个功能需要多久一次?如果它不是语言的一部分,会不会有任何问题?




几分钟前,我只需要在课堂上使用它声明...


class ParticleDistributionBehaviorServer \

(Microphysics__POA.ParticleDistributionBehavior):


我不得不拆分该行适合80列,没有''\''

字符我得到以下错误:


=====


python scoping_server.py --POA

文件" scoping_server.py",第8行

class ParticleDistributionBehaviorServer

^

语法错误:语法无效

=====


所以你这个事实在表达不完整的情况下不需要它

消除了*大部分*的需要,但仍然有一些情况

需要它。


问候,

Derek。


< blockquote>

" Derek Thomson" <德*** @ hiredgoons.org>在消息中写道

news:40 ****** @ duster.adelaide.on.net ...

Russell Wallace写道:

大家好,

Python允许您在多个物理线路上继续使用单条逻辑线路,方法是在最后放置一个\或自动将其发送到
一个不完整的中缀运算符。

我想知道这个功能需要多久一次?如果它不是语言的一部分,会不会有任何问题?

几分钟前,我只需要在课堂宣言中使用它......

类ParticleDistributionBehaviorServer \
(Microphysics__POA.ParticleDistributionBehavior):

我不得不拆分行以适应80列,而没有''\''
字符我收到以下错误:

=====


Hi all,

Python lets you continue a single logical line across more than one
physical line, either by putting a \ at the end or letting it happen
automatically with an incomplete infix operator.

I''m wondering how often is this feature needed? Would there be any
problems if it weren''t part of the language?

--
"Sore wa himitsu desu."
To reply by email, remove
the small snack from address.
http://www.esatclear.ie/~rwallace

解决方案

Russell Wallace wrote:

Hi all,

Python lets you continue a single logical line across more than one
physical line, either by putting a \ at the end or letting it happen
automatically with an incomplete infix operator.

I''m wondering how often is this feature needed? Would there be any
problems if it weren''t part of the language?



I just needed to use this a few minutes ago, in a class declaration ...

class ParticleDistributionBehaviorServer \
(Microphysics__POA.ParticleDistributionBehavior):

I had to split the line to fit within 80 columns, and without the ''\''
character I get the following error:

=====


python scoping_server.py --POA
File "scoping_server.py", line 8
class ParticleDistributionBehaviorServer
^
SyntaxError: invalid syntax
=====

So the fact that you don''t need it in the case of incomplete expressions
eliminates *most* of the need for it, but there are still a few cases
where it is required.

Regards,
Derek.



"Derek Thomson" <de***@hiredgoons.org> wrote in message
news:40******@duster.adelaide.on.net...

Russell Wallace wrote:

Hi all,

Python lets you continue a single logical line across more than one
physical line, either by putting a \ at the end or letting it happen
automatically with an incomplete infix operator.

I''m wondering how often is this feature needed? Would there be any
problems if it weren''t part of the language?

I just needed to use this a few minutes ago, in a class declaration ...

class ParticleDistributionBehaviorServer \
(Microphysics__POA.ParticleDistributionBehavior):

I had to split the line to fit within 80 columns, and without the ''\''
character I get the following error:

=====


这篇关于是否需要延续线?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆