2007年02月15日 星期四 01:17
_doc_ ºÍ __doc__ ²»Í¬£¬ÄãÉÙÁËÒ»¶Ô _ ----- Original Message ----- From: »áÀíÏÄ To: python-chinese在lists.python.cn Sent: Wednesday, February 14, 2007 9:03 AM Subject: [python-chinese] ÐÂÊÖÎÊÌ⣬¹ØÓÚDocStrings ÎÒÕýÔÚ¿´¡¶¼òÃ÷ Python ½Ì³Ì¡·£¬ÆäÖÐÒ»ÀýÈçÏ£º Àý7.8 ʹÓÃDocStrings #!/usr/bin/python # Filename: func_doc.py def printMax(x, y): '''Prints the maximum of two numbers. The two values must be integers.''' x = int(x) # convert to integers, if possible y = int(y) if x > y: print x, 'is maximum' else: print y, 'is maximum' printMax(3, 5) print printMax.__doc__ £¨Ô´Îļþ£ºcode/func_doc.py£© Êä³ö $ python func_doc.py 5 is maximum Prints the maximum of two numbers. The two values must be integers. µ«ÊÇÎÒÔËÐÐʱ£¬È´µÃµ½ÈçÏ»ØÏÔ£º 5 is maximum Traceback (most recent call last): File "D:\Python25\func_doc.py", line 16, inprint printMax._doc_ AttributeError: 'function' object has no attribute '_doc_' googleÁËһϣ¬Ã»ÓÐÕÒµ½´ð°¸£¬msÕâλÐÖµÜÒ²ºÍÎÒÊÇͬһ¸öÎÊÌâ Çë´ïÈ˴ͽ̣¬thx ------------------------------------------------------------------------------ _______________________________________________ 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/20070214/594899ae/attachment.htm
2007年02月14日 星期三 19:11
Ç°ºó¶¼ÊÇË«Ï»®Ïß¡£ ÔÚ07-2-15£¬Li Chunhui <lich在dhc.com.cn> дµÀ£º > > _doc_ ºÍ __doc__ ²»Í¬£¬ÄãÉÙÁËÒ»¶Ô _ > > > ----- Original Message ----- > *From:* »áÀíÏÄ <alovei0927在gmail.com> > *To:* python-chinese在lists.python.cn > *Sent:* Wednesday, February 14, 2007 9:03 AM > *Subject:* [python-chinese] ÐÂÊÖÎÊÌ⣬¹ØÓÚDocStrings > > > ÎÒÕýÔÚ¿´¡¶¼òÃ÷ Python ½Ì³Ì¡·£¬ÆäÖÐÒ»ÀýÈçÏ£º > > Àý7.8 ʹÓÃDocStrings > > #!/usr/bin/python > # Filename: func_doc.py > > def printMax(x, y): > '''Prints the maximum of two numbers. > > The two values must be integers.''' > x = int(x) # convert to integers, if possible > y = int(y) > > if x > y: > print x, 'is maximum' > else: > print y, 'is maximum' > > printMax(3, 5) > print printMax.__doc__ > > £¨Ô´Îļþ£ºcode/func_doc.py£© > Êä³ö > > $ python func_doc.py > 5 is maximum > Prints the maximum of two numbers. > > The two values must be integers. > > µ«ÊÇÎÒÔËÐÐʱ£¬È´µÃµ½ÈçÏ»ØÏÔ£º > > 5 is maximum > > Traceback (most recent call last): > File "D:\Python25\func_doc.py", line 16, in> print printMax._doc_ > AttributeError: 'function' object has no attribute '_doc_' > > googleÁËһϣ¬Ã»ÓÐÕÒµ½´ð°¸£¬msÕâλÐÖµÜ<http://mailman.linuxchix.org/pipermail/techtalk/2004-April/018394.html> > Ò²ºÍÎÒÊÇͬһ¸öÎÊÌâ > > Çë´ïÈ˴ͽ̣¬thx > > ------------------------------ > > _______________________________________________ > 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 > -- ±±Æû¸£ÌïÆû³µ¹¤³ÌÑо¿Ôº³ËÓóµËù Öì¼Ò·¢ 010-59912466 15980725004 -------------- 下一部分 -------------- Ò»¸öHTML¸½¼þ±»ÒƳý... URL: http://python.cn/pipermail/python-chinese/attachments/20070214/853be0f4/attachment.htm
2007年02月14日 星期三 22:51
ÔÀ´ÊÇÕâÑù£¬ÊÇÎÒÌ«´ÖÐÄÁË£¬Ð»Ð»Li ChunhuiºÍÖì¼Ò·¢¡£ ÔÚ07-2-14£¬Öì¼Ò·¢ <goowelane在gmail.com> дµÀ£º > > Ç°ºó¶¼ÊÇË«Ï»®Ïß¡£ > > ÔÚ07-2-15£¬Li Chunhui <lich在dhc.com.cn> дµÀ£º > > > > _doc_ ºÍ __doc__ ²»Í¬£¬ÄãÉÙÁËÒ»¶Ô _ > > > > > > ----- Original Message ----- > > *From:* »áÀíÏÄ <alovei0927在gmail.com> > > *To:* python-chinese在lists.python.cn > > *Sent:* Wednesday, February 14, 2007 9:03 AM > > *Subject:* [python-chinese] ÐÂÊÖÎÊÌ⣬¹ØÓÚDocStrings > > > > > > ÎÒÕýÔÚ¿´¡¶¼òÃ÷ Python ½Ì³Ì¡·£¬ÆäÖÐÒ»ÀýÈçÏ£º > > > > Àý7.8 ʹÓÃDocStrings > > > > #!/usr/bin/python > > # Filename: func_doc.py > > > > def printMax(x, y): > > '''Prints the maximum of two numbers. > > > > The two values must be integers.''' > > x = int(x) # convert to integers, if possible > > y = int(y) > > > > if x > y: > > print x, 'is maximum' > > else: > > print y, 'is maximum' > > > > printMax( 3, 5) > > print printMax.__doc__ > > > > £¨Ô´Îļþ£ºcode/func_doc.py£© > > Êä³ö > > > > $ python func_doc.py > > 5 is maximum > > Prints the maximum of two numbers. > > > > The two values must be integers. > > > > µ«ÊÇÎÒÔËÐÐʱ£¬È´µÃµ½ÈçÏ»ØÏÔ£º > > > > 5 is maximum > > > > Traceback (most recent call last): > > File "D:\Python25\func_doc.py", line 16, in> > print printMax._doc_ > > AttributeError: 'function' object has no attribute '_doc_' > > > > googleÁËһϣ¬Ã»ÓÐÕÒµ½´ð°¸£¬ms ÕâλÐÖµÜ<http://mailman.linuxchix.org/pipermail/techtalk/2004-April/018394.html> > > Ò²ºÍÎÒÊÇͬһ¸öÎÊÌâ > > > > Çë´ïÈ˴ͽ̣¬thx > > > > ------------------------------ > > > > _______________________________________________ > > 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 > > > > > > -- > ±±Æû¸£ÌïÆû³µ¹¤³ÌÑо¿Ôº³ËÓóµËù > Öì¼Ò·¢ > 010-59912466 > 15980725004 > _______________________________________________ > 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/20070214/6f3bddb0/attachment.htm
Zeuux © 2025
京ICP备05028076号