什么是Ruby相当于“pythonic”?

时间:2022-03-21 10:56:10

In the Python community, the term pythonic refers to idiomatic Python[1]. Is there an equivalent term in the Ruby community for idiomatic Ruby[2]?

在Python社区中,术语pythonic指的是惯用的Python [1]。在Ruby社区中是否存在用于惯用Ruby [2]的等价术语?

[1] For example, using enumerate(l) instead of range(len(l)) is pythonic.

[1]例如,使用枚举(l)而不是范围(len(l))是pythonic。

[2] For example, using .each instead of for is idiomatic Ruby.

[2]例如,使用.each而不是for是惯用的Ruby。

1 个解决方案

#1


4  

I've not heard of any such shorthand, presumably because there's no convenient suffix you can append to Ruby to turn it into an adjective :)

我没有听说过任何这样的速记,大概是因为没有方便的后缀你可以附加到Ruby上把它变成形容词:)

If you say something's idiomatic, and you're around rubyists, I think everybody will know what you mean.

如果你说某些东西是惯用的,而你就是红宝石,我想每个人都会知道你的意思。

#1


4  

I've not heard of any such shorthand, presumably because there's no convenient suffix you can append to Ruby to turn it into an adjective :)

我没有听说过任何这样的速记,大概是因为没有方便的后缀你可以附加到Ruby上把它变成形容词:)

If you say something's idiomatic, and you're around rubyists, I think everybody will know what you mean.

如果你说某些东西是惯用的,而你就是红宝石,我想每个人都会知道你的意思。