[python-chinese] 怎么改变形参的值?

jinq0123在163.com jinq0123在163.com
星期五 八月 3 10:24:40 HKT 2007


把所有形参打成一个list对象行不行?

swap_ab([a, b])

侯华隆 wrote:
> 谢谢~
> 那么把对象作为参数应该怎么编码呢?python的函数又没有制定参数类型
> 我是python新手,谢谢
> ------------------------------------------------------------------------
> 侯华隆
> 2007-08-01
> ------------------------------------------------------------------------
> *发件人:* shily escape
> *发送时间:* 2007-08-01 10:56:00
> *收件人:* python-chinese在lists.python.cn
> *抄送:*
> *主题:* Re: [python-chinese]怎么改变形参的值?
> python应该是传值的方式,也就是说原子类型像int是做不到传引用的, 对象的方
> 式应该是可以的,对象的传递应该也是传值,只是改变的是对象内部的状态, 而不
> 是改变对象的引用.
>
> 在07-8-1,*侯华隆* <hou_hl在sina.com <mailto:hou_hl在sina.com>> 写道:
>
>     就像c里用指针一样?
>     /*-------C---------*/
>     void fun(int* p)
>     {
>     *p = 3;
>     }
>     #python
>     ....
>     ?
>     我新手,谢谢大家
>     ------------------------------------------------------------------------
>     侯华隆
>     2007-08-01
>
>     _______________________________________________
>     python-chinese
>     Post: send python-chinese在lists.python.cn
>     <mailto:python-chinese在lists.python.cn>
>     Subscribe: send subscribe to
>     python-chinese-request在lists.python.cn
>     <mailto:python-chinese-request在lists.python.cn>
>     Unsubscribe: send unsubscribe to
>     python-chinese-request在lists.python.cn
>     <mailto: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


-- 
blog: http://blog.csdn.net/jq0123





关于邮件列表 python-chinese 的更多信息