为什么我 [英] why i

查看:64
本文介绍了为什么我的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从来没有得到这一点总是在我的电影书中我在范围内(...)

i never got this its always in my tutial bookfor i in range(...)

推荐答案

在星期二,25 2004年5月08:10:51 +1000,mr_vocab写道:
On Tue, 25 May 2004 08:10:51 +1000, mr_vocab wrote:
我从来没有得到它总是在我的tutial bookfor i in range(...)
i never got this its always in my tutial bookfor i in range(...)



" Index"。即,该变量将是您想要迭代的
数组的索引。


i的使用由FORTRAN语言颁布,允许

只有单字母变量名称(并且也是大写的,所以它实际上是我的b $ b)。 FOR语句通常用于遍历

数组,而I和J是用于
目的的常用索引变量。


-

\如果你写了''猴子'这个词一百万次,你会开始|

` \认为你莎士比亚? - Steven Wright |
_o__)|

Ben Finney< http://bignose.squidly.org/>



"Index". i.e., the variable will be the index of an array you want to
iterate over.

The usage of "i" was promulgated by the FORTRAN language, which allowed
only single-letter variable names (and was all upper case, too, so it
was actually I). The FOR statement was commonly used to iterate over an
array, and I and J were the commonly used index variables for that
purpose.

--
\ "If you write the word ''monkey'' a million times, do you start |
`\ to think you''re Shakespeare?" -- Steven Wright |
_o__) |
Ben Finney <http://bignose.squidly.org/>


On Tue,2004年5月25日08:10:51 +1000," mr_vocab"

< am ********** @ yahoo.com.au> ;写道:
On Tue, 25 May 2004 08:10:51 +1000, "mr_vocab"
<am**********@yahoo.com.au> wrote:
我从来没有得到它总是在我的tutial bookfor i in range(...)
i never got this its always in my tutial bookfor i in range(...)




它'是随意的,但是一些程序员使用i。在迭代中要么是
代表迭代或索引。


-

Aq2



It''s arbitrary, but some programmers use "i" in an iteration to either
stand for iteration or index.

--
Aq2


Ben Finney< bi **************** @ and-benfinney-does-too.id.au>写在

news:sl ******************************* @ rose.locald omain。假:
Ben Finney <bi****************@and-benfinney-does-too.id.au> wrote in
news:sl*******************************@rose.locald omain.fake:
2004年5月25日星期二08:10:51 +1000,mr_vocab写道:
On Tue, 25 May 2004 08:10:51 +1000, mr_vocab wrote:
我从来没有得到它总是在我的tutial bookfor i在范围(...)
i never got this its always in my tutial bookfor i in range(...)



索引。即,变量将是您想要迭代的数组的索引。

i的使用。由FORTRAN语言颁布,允许只有单字母变量名称(并且也是大写的,所以它实际上是我)。 FOR语句通常用于遍历
数组,而I和J是该目的常用的索引变量。



"Index". i.e., the variable will be the index of an array you want to
iterate over.

The usage of "i" was promulgated by the FORTRAN language, which allowed
only single-letter variable names (and was all upper case, too, so it
was actually I). The FOR statement was commonly used to iterate over an
array, and I and J were the commonly used index variables for that
purpose.




关闭,但不完全。


早期版本的Fortran支持最多6个字符的变量名。

实际上,Fortran总是允许更长的变量名,但是只有第一个

6才有意义。我相信它是6个字符的原因是

,字符长度为36位,字符集中有64个字符(因为你说b $ b b,不是小写),你可以准确地将一个6个字符的字符串打包成1个

机器字。


每个人使用I然后J作为for循环索引的实际原因

是Fortran,默认情况下,假设所有以IN字母开头的变量是来自IN的整数,所有其他变量名都是真的。整数

以I开头的名字大概是根据其助记符值选择的,

其他字母依次按顺序排列,大概足够了什么

原始语言设计师认为是合理的20:6分割真实到

整数变量。


显然你会选择一些非常有意义的东西:^) 6个字符名称

表示所有重要的线性回归库函数,但对于一个简单的
循环,为什么要这么麻烦。



Close, but not quite there.

Early versions of Fortran supported variable names up to 6 characters long.
Actually, Fortran always allowed longer variable names, but only the first
6 were significant. I believe the reason why it was 6 characters was that
with a 36bit word length and 64 characters in your character set (as you
say, no lower case), you could exactly pack a 6 character string into 1
machine word.

The actual reason why everyone uses I and then J as the for loop indexes
was that Fortran, by default, assumed all variables starting with letters
from I-N were integer, and all other variable names were real. Integer
names starting with I was presumably chosen for its mnemonic value and the
other letters then follow on in sequence, presumably far enough for what
the original language designers thought was a reasonable 20:6 split real to
integer variables.

Obviously you are going to pick some really meaningful :^) 6 character name
for that all important linear-regression library function but for a simple
loop, why bother.


这篇关于为什么我的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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