2006年09月07日 星期四 08:56
看看这个链接。http://www.rubygarden.org/faq/entry/show/25 如果碰巧不是看到这个,有谁会知道ruby还有这个阴暗面。
2006年09月07日 星期四 09:26
链接失效,能否提供一下文章的标题,我们也好google一下去。
2006年09月07日 星期四 10:05
On 9/7/06, shhgs <shhgs.efhilt在gmail.com> wrote: > 看看这个链接。http://www.rubygarden.org/faq/entry/show/25 > > 如果碰巧不是看到这个,有谁会知道ruby还有这个阴暗面。 无法打开链接,复制一下全文,来学习吧………… > _______________________________________________ > python-chinese > Post: send python-chinese在lists.python.cn > Subscribe: send subscribe to python-chinese-request在lists.python.cn > Unsubscribe: send unsubscribe to python-chinese-request在lists.python.cn > Detail Info: http://python.cn/mailman/listinfo/python-chinese -- """Time is unimportant, only life important! blogging : http://blog.zoomquiet.org/pyblosxom/ wiki enter: http://wiki.woodpecker.org.cn/moin/ZoomQuiet in douban: http://www.douban.com/people/zoomq/ """
2006年09月07日 星期四 10:19
TIMTOWTDI 并不是什么好的哲学。 Ruby fans肯定会说你不要这么写。但问题是明知不要这么写,你为什么还要提供这种方法。难道你提供的feature有些是给人用的,有些是给人看的? 此外,还有一个比较搞的地方。 foobar a,b {...} 和 foobar a,b do ,,, end 居然是不一样的。前者相当于 foobar(a, b {...} ) 后者则是 foobar(a,b) {...} ---------------------------------------------------------------------------------------------------------------- Actually, the question may be better asked as: "at what point does Ruby work out that something is a variable?" The problem arises because the simple expression ``a'' could be either a variable or a call to a method with no parameters. To decide which is the case, Ruby looks for assignment statements. If at some point in the source prior to the use of "a" it sees it being assigned to, it decides to parse "a" as a variable, otherwise it treats it as a method. As a somewhat pathological case of this, consider this code fragment, submitted by Clemens Hintze: def a print "Function 'a' called\n" 99 end for i in 1..2 if i == 2 print "a=", a, "\n" else a = 1 print "a=", a, "\n" end end produces: a=1 Function 'a' called a=99 During the parse, Ruby sees the use of "a" in the first print statement and, as it hasn't yet seen any assignment to ``a'', assumes that it is a method call. By the time it gets to the second print statement, though, it has seen an assignment, and so treats "a" as a variable. Note that the assignment does not have to be executed—Ruby just has to have seen it. This program does not raise an error. a = 1 if false; a This issue with variables is not normally a problem. If you do bump into it, try putting an assignment such as a = nil before the first access to the variable. This has the additional benefit of speeding up the access time to local variables that subsequently appear in loops. ---------------------------------------------------------------------------------------------------------------- On 9/6/06, Zoom. Quiet <zoom.quiet在gmail.com> wrote: > On 9/7/06, shhgs <shhgs.efhilt在gmail.com> wrote: > > 看看这个链接。http://www.rubygarden.org/faq/entry/show/25 > > > > 如果碰巧不是看到这个,有谁会知道ruby还有这个阴暗面。 > 无法打开链接,复制一下全文,来学习吧………… > > > _______________________________________________ > > python-chinese > > Post: send python-chinese在lists.python.cn > > Subscribe: send subscribe to python-chinese-request在lists.python.cn > > Unsubscribe: send unsubscribe to python-chinese-request在lists.python.cn > > Detail Info: http://python.cn/mailman/listinfo/python-chinese > > > -- > """Time is unimportant, only life important! > blogging : http://blog.zoomquiet.org/pyblosxom/ > wiki enter: http://wiki.woodpecker.org.cn/moin/ZoomQuiet > in douban: http://www.douban.com/people/zoomq/ > """ > _______________________________________________ > python-chinese > Post: send python-chinese在lists.python.cn > Subscribe: send subscribe to python-chinese-request在lists.python.cn > Unsubscribe: send unsubscribe to python-chinese-request在lists.python.cn > Detail Info: http://python.cn/mailman/listinfo/python-chinese
2006年09月07日 星期四 12:04
Fæò!ö²¦§¶)í ë(º·¦¸¨®Ú- ë¬zÚÛzÈm觫, ÞvÚ"µ×׬¶Z®ÇjƯj¸nW¨¶«Â+Ûky«lÖ¬jgZFæòuçÚ¦¸§´[§rب§Wß^×è®(§×hjk{Zjw¥±æ
2006年09月07日 星期四 12:05
Ó¯{ºx±¹©à¨¥r¢¸¢]¢~
2006年09月07日 星期四 12:34
问题是,如果你不看这篇文章你知道ruby的这个特性吗?你能根据已知的常识推导出这个结论吗? 如果你没看这篇文章,写代码的时候又碰巧遇到了这个问题,请问你要花多长时间才能找出这个问题? 如果你根本不知道有这篇文章,写代码的时候又碰巧遇上了这个问题,花了很长(或者不长)时间修补好了程序。请问你能保证下一次再也不会遇上这个问题了吗? 一个秘而不宣的feature,可能会成为让你反反复复地栽跟头的陷阱。请问这个问题难道还不严重吗? On 9/7/06, 周宇轩 <unixuan在gmail.com> wrote: > > > 在06-9-7,周宇轩 <unixuan在gmail.com> 写道: > > > > for i in 1..2 > > if i == 2 > > > > print "a=", a, "\n" #此时不存在同名的现象,埋所当然解析为办法调动 > > else > > > Sorry,打错字了。 > ....埋所当然解析为办法调动 方法调动 > > _______________________________________________ > python-chinese > Post: send python-chinese在lists.python.cn > Subscribe: send subscribe to > python-chinese-request在lists.python.cn > Unsubscribe: send unsubscribe to > python-chinese-request在lists.python.cn > Detail Info: > http://python.cn/mailman/listinfo/python-chinese >
2006年09月07日 星期四 12:37
On 9/7/06, shhgs <shhgs.efhilt在gmail.com> wrote: > 问题是,如果你不看这篇文章你知道ruby的这个特性吗?你能根据已知的常识推导出这个结论吗? > > 如果你没看这篇文章,写代码的时候又碰巧遇到了这个问题,请问你要花多长时间才能找出这个问题? > > 如果你根本不知道有这篇文章,写代码的时候又碰巧遇上了这个问题,花了很长(或者不长)时间修补好了程序。请问你能保证下一次再也不会遇上这个问题了吗? > > 一个秘而不宣的feature,可能会成为让你反反复复地栽跟头的陷阱。请问这个问题难道还不严重吗? "一个秘而不宣的feature,可能会成为让你反反复复地栽跟头的陷阱" 非常同意!不论出于什么目的这么作和M$ 无异了! > > > > On 9/7/06, 周宇轩 <unixuan在gmail.com> wrote: > > > > > > 在06-9-7,周宇轩 <unixuan在gmail.com> 写道: > > > > > > for i in 1..2 > > > if i == 2 > > > > > > print "a=", a, "\n" #此时不存在同名的现象,埋所当然解析为办法调动 > > > else > > > > > Sorry,打错字了。 > > ....埋所当然解析为办法调动 方法调动 > > > > _______________________________________________ > > python-chinese > > Post: send python-chinese在lists.python.cn > > Subscribe: send subscribe to > > python-chinese-request在lists.python.cn > > Unsubscribe: send unsubscribe to > > python-chinese-request在lists.python.cn > > Detail Info: > > http://python.cn/mailman/listinfo/python-chinese > > > _______________________________________________ > python-chinese > Post: send python-chinese在lists.python.cn > Subscribe: send subscribe to python-chinese-request在lists.python.cn > Unsubscribe: send unsubscribe to python-chinese-request在lists.python.cn > Detail Info: http://python.cn/mailman/listinfo/python-chinese -- """Time is unimportant, only life important! blogging : http://blog.zoomquiet.org/pyblosxom/ wiki enter: http://wiki.woodpecker.org.cn/moin/ZoomQuiet in douban: http://www.douban.com/people/zoomq/ """
2006年09月07日 星期四 12:48
ÕâÄÄÊÇʲôÃضø²»Ðû£¿ÄãËùÒýÓõÄFAQ²»¾ÍÊdzö×Ô¹Ù·½µÄRubyGardenÂï¡£ ÔÚ½Ó´¥Ò»ÃÅеÄÓïÑÔ֮ǰ£¬µ±È»ÐèÒª¶ÔÆäµÄÓï·¨ÌØÕ÷ºÍÉè¼ÆÕÜѧ½øÐÐÁ˽⡣ ÏíÊÜÆäÓï·¨´øÀ´µÄÓÅÑÅ£¬±ØÐëµÃ³ÐÊÜÒò´Ë´øÀ´µÄһЩ²»±ãºÍȱÏÝ£¨ÈçÔËËãËٶȣ©¡£ ¾Í¿´ÄãÈçºÎȨºâÀ²¡£ 2006/9/7, shhgs <shhgs.efhilt在gmail.com>: > > ÎÊÌâÊÇ£¬Èç¹ûÄã²»¿´ÕâƪÎÄÕÂÄãÖªµÀrubyµÄÕâ¸öÌØÐÔÂð£¿ÄãÄܸù¾ÝÒÑÖªµÄ³£Ê¶ÍƵ¼³öÕâ¸ö½áÂÛÂ𣿠> > Èç¹ûÄãû¿´ÕâƪÎÄÕ£¬Ð´´úÂëµÄʱºòÓÖÅöÇÉÓöµ½ÁËÕâ¸öÎÊÌ⣬ÇëÎÊÄãÒª»¨¶à³¤Ê±¼ä²ÅÄÜÕÒ³öÕâ¸öÎÊÌ⣿ > > Èç¹ûÄã¸ù±¾²»ÖªµÀÓÐÕâƪÎÄÕ£¬Ð´´úÂëµÄʱºòÓÖÅöÇÉÓöÉÏÁËÕâ¸öÎÊÌ⣬»¨Á˺ܳ¤£¨»òÕß²»³¤£©Ê±¼äÐÞ²¹ºÃÁ˳ÌÐò¡£ÇëÎÊÄãÄܱ£Ö¤ÏÂÒ»´ÎÔÙÒ²²»»áÓöÉÏÕâ¸öÎÊÌâÁËÂ𣿠> > Ò»¸öÃضø²»ÐûµÄfeature£¬¿ÉÄÜ»á³ÉΪÈÃÄã·´·´¸´¸´µØÔÔ¸úÍ·µÄÏÝÚå¡£ÇëÎÊÕâ¸öÎÊÌâÄѵÀ»¹²»ÑÏÖØÂ𣿠> -------------- 下一部分 -------------- Ò»¸öHTML¸½¼þ±»ÒƳý... URL: http://python.cn/pipermail/python-chinese/attachments/20060907/d164cba6/attachment.htm
2006年09月07日 星期四 15:54
÷пï¢Ø¢¸
2006年09月07日 星期四 16:25
÷пï×@¿ï¶Ðêâ)ÚǬ±¨º&-ê k$è§+a¢w!w¬zX¬¶Êr¶'rtÔẻk$¦×¦mêôïm4ë~x<Ä®n7µ©ÊØhÈbë÷пï¢Ø¢¸
2006年09月07日 星期四 16:28
´úÂëдµÄ¹îÒìÄѶ®µÄÄÇÊÇ´«ËµÖеĺڿͣ¡ Qutr£¬qutianrang在gmail.com 2006-09-07 ----- Original Message ----- From: Leo Jay To: python-chinese Sent: 2006-09-07, 15:54:59 Subject: Re: [python-chinese]Ë˵Óï·¨Áé»îÊÇÓаÙÀû¶øÎÞÒ»º¦ ÿ¸öÓïÑÔ¶¼»áÓÐһЩ²»ÊǺÜÒ׶®µÄµØ·½¡£ ±È·½Ëµ£¬ÎÒ¸Ò´ò¶Ä£¬99%µÄC/C++³ÌÐòÔ±²»ÄÜÕýÈ·µÄ˵³öÏÂÃæ³ÌÐòµÄ½á¹û£º int i; for(i=0; i<10; i++) { // print square????/ printf("%d ", i*i); } д³ÌÐòµ±È»ÒÔ·½±ãÒ׶®ÎªÄ¿±êÁË¡£²»Ò׶®¾Í»»ÖÖд·¨»ò²»Ð´Âï¡£ -- Best Regards, Leo Jay -------------- 下一部分 -------------- Ò»¸öHTML¸½¼þ±»ÒƳý... URL: http://python.cn/pipermail/python-chinese/attachments/20060907/fb144183/attachment-0001.html
2006年09月07日 星期四 17:05
ÕýÈ·´ð°¸ÊÇʲô£¿ ÔÚ06-9-7£¬Leo Jay <python.leojay在gmail.com> дµÀ£º > > ÿ¸öÓïÑÔ¶¼»áÓÐһЩ²»ÊǺÜÒ׶®µÄµØ·½¡£ > ±È·½Ëµ£¬ÎÒ¸Ò´ò¶Ä£¬99%µÄC/C++³ÌÐòÔ±²»ÄÜÕýÈ·µÄ˵³öÏÂÃæ³ÌÐòµÄ½á¹û£º > int i; > for(i=0; i<10; i++) > { > // print square????/ > printf("%d ", i*i); > } > > д³ÌÐòµ±È»ÒÔ·½±ãÒ׶®ÎªÄ¿±êÁË¡£²»Ò׶®¾Í»»ÖÖд·¨»ò²»Ð´Âï¡£ > > > -- > Best Regards, > Leo Jay > > _______________________________________________ > python-chinese > Post: send python-chinese在lists.python.cn > Subscribe: send subscribe to python-chinese-request在lists.python.cn > Unsubscribe: send unsubscribe to python-chinese-request在lists.python.cn > Detail Info: http://python.cn/mailman/listinfo/python-chinese > -------------- 下一部分 -------------- Ò»¸öHTML¸½¼þ±»ÒƳý... URL: http://python.cn/pipermail/python-chinese/attachments/20060907/31a02924/attachment.htm
2006年09月07日 星期四 17:11
:ïý:²ê^¯Îvf¢Ê&º-x¬µ j·l-ê k!Ó0µ.m§ÿéÊØhÉÿ¦*^®f¢úr¶'r§zÇ¿jÛZrÛ?ÛM:ÓÝ;ÿg[oÎöµ§!éíÓM5Ù¥
2006年09月07日 星期四 17:20
On 09/07/2006 at 16:25, chris wrote: > 偶绝不相信99%的C/C++程序员不能正确说出这个结果 > 如果是C程序员,最多10% > 如果是C/C++程序员,也不会超过20% 这种东西不看标准的话应该是不知道的,我还没见过有哪本书提到这个 > ----- Original Message ----- > From: Leo Jay > To: python-chinese在lists.python.cn > Sent: Thursday, September 07, 2006 3:54 PM > Subject: Re: [python-chinese]谁说语法灵活是有百利而无一害 > > > 每个语言都会有一些不是很易懂的地方。 > 比方说,我敢打赌,99%的C/C++程序员不能正确的说出下面程序的结果: > int i; > for(i=0; i<10; i++) > { > // print square????/ > printf("%d ", i*i); > } > > 写程序当然以方便易懂为目标了。不易懂就换种写法或不写嘛。 > > > -- > Best Regards, > Leo Jay > > > ------------------------------------------------------------------------------ > > > _______________________________________________ > python-chinese > Post: send python-chinese在lists.python.cn > Subscribe: send subscribe to python-chinese-request在lists.python.cn > Unsubscribe: send unsubscribe to python-chinese-request在lists.python.cn > Detail Info: http://python.cn/mailman/listinfo/python-chinese_______________________________________________ > python-chinese > Post: send python-chinese在lists.python.cn > Subscribe: send subscribe to python-chinese-request在lists.python.cn > Unsubscribe: send unsubscribe to python-chinese-request在lists.python.cn > Detail Info: http://python.cn/mailman/listinfo/python-chinese -- (reply-to (concat "snlee99" "@" "tom" "." "com"))
2006年09月07日 星期四 17:44
说实话,我就没懂。。。 2006/9/7, Darren <snlee99 at tom.com>: > On 09/07/2006 at 16:25, chris wrote: > > > 偶绝不相信99%的C/C++程序员不能正确说出这个结果 > > 如果是C程序员,最多10% > > 如果是C/C++程序员,也不会超过20% > > 这种东西不看标准的话应该是不知道的,我还没见过有哪本书提到这个 > > > ----- Original Message ----- > > From: Leo Jay > > To: python-chinese at lists.python.cn > > Sent: Thursday, September 07, 2006 3:54 PM > > Subject: Re: [python-chinese]谁说语法灵活是有百利而无一害 > > > > > > 每个语言都会有一些不是很易懂的地方。 > > 比方说,我敢打赌,99%的C/C++程序员不能正确的说出下面程序的结果: > > int i; > > for(i=0; i<10; i++) > > { > > // print square????/ > > printf("%d ", i*i); > > } > > > > 写程序当然以方便易懂为目标了。不易懂就换种写法或不写嘛。 > > > > > > -- > > Best Regards, > > Leo Jay > > > > > > ------------------------------------------------------------------------------ > > > > > > _______________________________________________ > > python-chinese > > Post: send python-chinese at lists.python.cn > > Subscribe: send subscribe to python-chinese-request at lists.python.cn > > Unsubscribe: send unsubscribe to python-chinese-request at lists.python.cn > > Detail Info: http://python.cn/mailman/listinfo/python-chinese_______________________________________________ > > python-chinese > > Post: send python-chinese at lists.python.cn > > Subscribe: send subscribe to python-chinese-request at lists.python.cn > > Unsubscribe: send unsubscribe to python-chinese-request at lists.python.cn > > Detail Info: http://python.cn/mailman/listinfo/python-chinese > > -- > (reply-to (concat "snlee99" "@" "tom" "." "com")) > > _______________________________________________ > python-chinese > Post: send python-chinese at lists.python.cn > Subscribe: send subscribe to python-chinese-request at lists.python.cn > Unsubscribe: send unsubscribe to python-chinese-request at lists.python.cn > Detail Info: http://python.cn/mailman/listinfo/python-chinese
2006年09月07日 星期四 18:00
请指教理由~ ----- Original~ Message ----- From: Leo Jay To: python-chinese at lists.python.cn Sent: Thursday, September 07, 2006 5:11 PM Subject: Re: [python-chinese]谁说语法灵活是有百利而无一害 On 9/7/06, 头太晕 <super852 at gmail.com> wrote: 正确答案是什么? 正确答案是,这段程序什么也不输出。呵呵。 -- Best Regards, Leo Jay ------------------------------------------------------------------------------ _______________________________________________ python-chinese Post: send python-chinese at lists.python.cn Subscribe: send subscribe to python-chinese-request at lists.python.cn Unsubscribe: send unsubscribe to python-chinese-request at lists.python.cn Detail Info: http://python.cn/mailman/listinfo/python-chinese -------------- next part -------------- An HTML attachment was scrubbed... URL: http://python.cn/pipermail/python-chinese/attachments/20060907/ff75246a/attachment.html
2006年09月07日 星期四 18:30
没懂的把编译器警告级别调高编译一下就知道了。。。关键在于/ ----- Original Message ----- From: "helium" <helium.sun at gmail.com> To: <python-chinese at lists.python.cn> Sent: Thursday, September 07, 2006 5:44 PM Subject: Re: [python-chinese]谁说语法灵活是有百利而无一害 > 说实话,我就没懂。。。 > > 2006/9/7, Darren <snlee99 at tom.com>: >> On 09/07/2006 at 16:25, chris wrote: >> >> > 偶绝不相信99%的C/C++程序员不能正确说出这个结果 >> > 如果是C程序员,最多10% >> > 如果是C/C++程序员,也不会超过20% >> >> 这种东西不看标准的话应该是不知道的,我还没见过有哪本书提到这个 >> >> > ----- Original Message ----- >> > From: Leo Jay >> > To: python-chinese at lists.python.cn >> > Sent: Thursday, September 07, 2006 3:54 PM >> > Subject: Re: [python-chinese]谁说语法灵活是有百利而无一害 >> > >> > >> > 每个语言都会有一些不是很易懂的地方。 >> > 比方说,我敢打赌,99%的C/C++程序员不能正确的说出下面程序的结果: >> > int i; >> > for(i=0; i<10; i++) >> > { >> > // print square????/ >> > printf("%d ", i*i); >> > } >> > >> > 写程序当然以方便易懂为目标了。不易懂就换种写法或不写嘛。 >> > >> > >> > -- >> > Best Regards, >> > Leo Jay >> > >> > >> > ------------------------------------------------------------------------------ >> > >> > >> > _______________________________________________ >> > python-chinese >> > Post: send python-chinese at lists.python.cn >> > Subscribe: send subscribe to python-chinese-request at lists.python.cn >> > Unsubscribe: send unsubscribe to python-chinese-request at lists.python.cn >> > Detail Info: http://python.cn/mailman/listinfo/python-chinese_______________________________________________ >> > python-chinese >> > Post: send python-chinese at lists.python.cn >> > Subscribe: send subscribe to python-chinese-request at lists.python.cn >> > Unsubscribe: send unsubscribe to python-chinese-request at lists.python.cn >> > Detail Info: http://python.cn/mailman/listinfo/python-chinese >> >> -- >> (reply-to (concat "snlee99" "@" "tom" "." "com")) >> >> _______________________________________________ >> python-chinese >> Post: send python-chinese at lists.python.cn >> Subscribe: send subscribe to python-chinese-request at lists.python.cn >> Unsubscribe: send unsubscribe to python-chinese-request at lists.python.cn >> Detail Info: http://python.cn/mailman/listinfo/python-chinese > _______________________________________________ > python-chinese > Post: send python-chinese at lists.python.cn > Subscribe: send subscribe to python-chinese-request at lists.python.cn > Unsubscribe: send unsubscribe to python-chinese-request at lists.python.cn > Detail Info: http://python.cn/mailman/listinfo/python-chinese
2006年09月07日 星期四 19:29
On 09/07/2006 at 18:00, dengpeng wrote: > 请指教理由~ http://msdn.microsoft.com/library/en-us/vccelng/htm/eleme_8.asp?frame=true -- (reply-to (concat "snlee99" "@" "tom" "." "com"))
2006年09月07日 星期四 19:49
明白了 , 应该是因为注释行末尾的 / 把下一行连接起来也变成注释了吧. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://python.cn/pipermail/python-chinese/attachments/20060907/47bb2f3d/attachment.html
2006年09月07日 星期四 21:32
:ïý:Ê(njx2ÊzZÉêਥr°®^þÜ)Þ±ãè²ÛÚr¶'r§zÇ¥Ël§+a¢w'Jæìr¸zǧv˱Êâmëh§+a¢w!w¬z·ª¹ë-+-²ÜIì¹»®&Þ±éݺ{.nÇ+·¢Ü)Þ±êު笶X¬¶Êr¶'rpÞµ¨¥"wèÛiÿúr¶'ræj)fjåËbú?§+a¢w!w¬x6¯ëã2Z Ûiÿöå¢Z¾'¬+§zßÇLÂÔD¸m¶ÿ§+a¢w'þ©z¹_éÊØhÈbëý«miÈfz{lÿm4ëOtïþ½ã·tóoÚ¶Ög§¶f
Zeuux © 2025
京ICP备05028076号