﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>C++博客-曲凡的C/C＋＋程序生活-文章分类-脚本语言</title><link>http://www.cppblog.com/jetqu2003/category/7202.html</link><description>软件人生</description><language>zh-cn</language><lastBuildDate>Thu, 29 May 2008 13:27:11 GMT</lastBuildDate><pubDate>Thu, 29 May 2008 13:27:11 GMT</pubDate><ttl>60</ttl><item><title>python中的一个函数定义</title><link>http://www.cppblog.com/jetqu2003/articles/51275.html</link><dc:creator>relaxqu</dc:creator><author>relaxqu</author><pubDate>Tue, 27 May 2008 07:13:00 GMT</pubDate><guid>http://www.cppblog.com/jetqu2003/articles/51275.html</guid><wfw:comment>http://www.cppblog.com/jetqu2003/comments/51275.html</wfw:comment><comments>http://www.cppblog.com/jetqu2003/articles/51275.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/jetqu2003/comments/commentRss/51275.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/jetqu2003/services/trackbacks/51275.html</trackback:ping><description><![CDATA[函数可以通过关键字参数的形式来调用<br>以下为一个示例 <br>def parrot(voltage, state=&#8217;a stiff&#8217;, action=&#8217;voom&#8217;, type=&#8217;Norwegian Blue&#8217;):<br>print "-- This parrot wouldn&#8217;t", action,<br>print "if you put", voltage, "volts through it."<br>print "-- Lovely plumage, the", type<br>print "-- It&#8217;s", state, "!"<br>could be called in any of the following ways:<br>正确的调用<br>parrot(1000)<br>parrot(action = &#8217;VOOOOOM&#8217;, voltage = 1000000)<br>parrot(&#8217;a thousand&#8217;, state = &#8217;pushing up the daisies&#8217;)<br>parrot(&#8217;a million&#8217;, &#8217;bereft of life&#8217;, &#8217;jump&#8217;)<br>but the following calls would all be invalid:<br>以下调用是不正确的<br>parrot() # required argument missing<br>parrot(voltage=5.0, &#8217;dead&#8217;) 没有关键字参数<br>parrot(110, voltage=220) 定义了重复的值<br>parrot(actor=&#8217;John Cleese&#8217;) 不知道的参数 
<img src ="http://www.cppblog.com/jetqu2003/aggbug/51275.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/jetqu2003/" target="_blank">relaxqu</a> 2008-05-27 15:13 <a href="http://www.cppblog.com/jetqu2003/articles/51275.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>