Python论坛  - 讨论区

标题:[python-chinese] python引用计数的问题

2007年10月11日 星期四 16:54

leopay leopay在gmail.com
星期四 十月 11 16:54:41 HKT 2007

>>>import sys
>>>sys.getrefcount(1)
>>>136
>>>a=1
 >>>sys.getrefcount(1)
>>>137
 >>>sys.getrefcount(1)
>>>136
Ϊʲôsys.getrefcount(1)ºÍsys.getrefcount(a)µÄ½á¹û²î1£¿
-------------- 下一部分 --------------
Ò»¸öHTML¸½¼þ±»ÒƳý...
URL: http://python.cn/pipermail/python-chinese/attachments/20071011/5de20bb8/attachment.htm 

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2007年10月11日 星期四 22:01

FireBird ygonic在gmail.com
星期四 十月 11 22:01:04 HKT 2007

Çë¿´°ïÖú£º

    Return the reference count of object.  The count returned is generally
    one higher than you might expect, because it includes the (temporary)
    reference as an argument to getrefcount().

ʹÓÃ1×ö²ÎÊýµÄʱºò£¬Ëü»á¶àÒ»¸ö²ÎÊýÒýÓ㬶øʹÓÃa×ö²ÎÊý£¬Ôò²»»á¶à³öÕâÒ»¸ö²ÎÊýÒýÓá£

Áí£ºÄãµÄ3¸ösys.getrefcount()µÄ²ÎÊý¶¼ÊÇ1¡£
ÔÚ 07-10-11£¬leopay<leopay在gmail.com> дµÀ£º
> >>>import sys
> >>>sys.getrefcount(1)
> >>>136
> >>>a=1
>
> >>>sys.getrefcount(1)
> >>>137
>
> >>>sys.getrefcount(1)

Õâ¸öÓ¦¸ÃÊÇsys.getrefcount(a)

> >>>136
> Ϊʲôsys.getrefcount(1)ºÍsys.getrefcount(a)µÄ½á¹û²î1£¿
>
>
> _______________________________________________
> 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/20071011/d54c4e7a/attachment.htm 

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2007年10月11日 星期四 22:22

leopay leopay在gmail.com
星期四 十月 11 22:22:38 HKT 2007

>ʹÓÃ1×ö²ÎÊýµÄʱºò£¬Ëü»á¶àÒ»¸ö²ÎÊýÒýÓ㬶øʹÓÃa×ö²ÎÊý£¬Ôò²»»á¶à³öÕâÒ»¸ö²ÎÊýÒýÓá£
ΪʲôʹÓÃa×ö²ÎÊýµÄʱºò£¬²»»á¶à³öÒ»¸ö²ÎÊýÒýÓã¿
a²»ÊÇÖ¸Ïò¶ÔÏó1Âð£¿


ÔÚ07-10-11£¬FireBird <ygonic在gmail.com> дµÀ£º
>
> Çë¿´°ïÖú£º
>
>     Return the reference count of object.  The count returned is generally
>     one higher than you might expect, because it includes the (temporary)
>     reference as an argument to getrefcount().
>
> ʹÓÃ1×ö²ÎÊýµÄʱºò£¬Ëü»á¶àÒ»¸ö²ÎÊýÒýÓ㬶øʹÓÃa×ö²ÎÊý£¬Ôò²»»á¶à³öÕâÒ»¸ö²ÎÊýÒýÓá£
>
> Áí£ºÄãµÄ3¸ösys.getrefcount ()µÄ²ÎÊý¶¼ÊÇ1¡£
> ÔÚ 07-10-11£¬leopay<leopay在gmail.com> дµÀ£º
> > >>>import sys
> > >>>sys.getrefcount(1)
> > >>>136
> > >>>a=1
> >
> > >>>sys.getrefcount(1)
> > >>>137
> >
> > >>>sys.getrefcount(1)
>
> Õâ¸öÓ¦¸ÃÊÇsys.getrefcount(a)
>
> > >>>136
> > Ϊʲôsys.getrefcount(1)ºÍsys.getrefcount (a)µÄ½á¹û²î1£¿
> >
> >
> > _______________________________________________
> > 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
>
-------------- 下一部分 --------------
Ò»¸öHTML¸½¼þ±»ÒƳý...
URL: http://python.cn/pipermail/python-chinese/attachments/20071011/d94d0246/attachment.html 

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2007年10月11日 星期四 22:32

FireBird ygonic在gmail.com
星期四 十月 11 22:32:11 HKT 2007

¾ßÌåµÄʵÏÖ»úÖÆÎÒûÓÐÑо¿£¬²»¹ý¸ù¾ÝCÓïÑÔµÄÔ­Àí£¬¶ÔÓÚ³£Êý×öΪ²ÎÊý£¬ÔÚº¯ÊýÖÐÆäʵÐèÒª×Ô¼ºÔÙÉêÃ÷
Ò»¸öÁÙʱµÄ±äÁ¿À´±£´æËü¡£Ò²¾ÍÊÇËùνµÄ×°Ïä²Ù×÷¡£

ÔÚ07-10-11£¬leopay <leopay在gmail.com> дµÀ£º
>
> >ʹÓÃ1×ö²ÎÊýµÄʱºò£¬Ëü»á¶àÒ»¸ö²ÎÊýÒýÓ㬶øʹÓÃa×ö²ÎÊý£¬Ôò²»»á¶à³öÕâÒ»¸ö²ÎÊýÒýÓá£
> ΪʲôʹÓÃa×ö²ÎÊýµÄʱºò£¬²»»á¶à³öÒ»¸ö²ÎÊýÒýÓã¿
> a²»ÊÇÖ¸Ïò¶ÔÏó1Âð£¿
>
>
> ÔÚ07-10-11£¬FireBird <ygonic在gmail.com> дµÀ£º
> >
> > Çë¿´°ïÖú£º
> >
> >     Return the reference count of object.  The count returned is
> > generally
> >      one higher than you might expect, because it includes the
> > (temporary)
> >     reference as an argument to getrefcount() .
> >
> > ʹÓÃ1×ö²ÎÊýµÄʱºò£¬Ëü»á¶àÒ»¸ö²ÎÊýÒýÓ㬶øʹÓÃa×ö²ÎÊý£¬Ôò²»»á¶à³öÕâÒ»¸ö²ÎÊýÒýÓá£
> >
> > Áí£ºÄãµÄ3¸ösys.getrefcount ()µÄ²ÎÊý¶¼ÊÇ1¡£
> > ÔÚ 07-10-11£¬leopay< leopay在gmail.com> дµÀ£º
> > > >>>import sys
> > > >>>sys.getrefcount(1)
> > > >>>136
> > > >>>a=1
> > >
> > > >>>sys.getrefcount(1)
> > > >>>137
> > >
> > > >>>sys.getrefcount(1)
> >
> > Õâ¸öÓ¦¸ÃÊÇsys.getrefcount(a)
> >
> > > >>>136
> > > Ϊʲôsys.getrefcount(1)ºÍsys.getrefcount (a)µÄ½á¹û²î1£¿
> > >
> > >
> > > _______________________________________________
> > > 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
> >
>
>
> _______________________________________________
> 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/20071011/30331a5d/attachment.htm 

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2007年10月11日 星期四 22:42

leopay leopay在gmail.com
星期四 十月 11 22:42:41 HKT 2007

thx

ÔÚ07-10-11£¬FireBird <ygonic在gmail.com> дµÀ£º
>
> ¾ßÌåµÄʵÏÖ»úÖÆÎÒûÓÐÑо¿£¬²»¹ý¸ù¾ÝCÓïÑÔµÄÔ­Àí£¬¶ÔÓÚ³£Êý×öΪ²ÎÊý£¬ÔÚº¯ÊýÖÐÆäʵÐèÒª×Ô¼ºÔÙÉêÃ÷
> Ò»¸öÁÙʱµÄ±äÁ¿À´±£´æËü¡£Ò²¾ÍÊÇËùνµÄ×°Ïä²Ù×÷¡£
>
> ÔÚ07-10-11£¬leopay <leopay在gmail.com> дµÀ£º
> >
> > >ʹÓÃ1×ö²ÎÊýµÄʱºò£¬Ëü»á¶àÒ»¸ö²ÎÊýÒýÓ㬶øʹÓÃa×ö²ÎÊý£¬Ôò²»»á¶à³öÕâÒ»¸ö²ÎÊýÒýÓá£
> > ΪʲôʹÓÃa×ö²ÎÊýµÄʱºò£¬²»»á¶à³öÒ»¸ö²ÎÊýÒýÓã¿
> > a²»ÊÇÖ¸Ïò¶ÔÏó1Âð£¿
> >
> >
> > ÔÚ07-10-11£¬FireBird <ygonic在gmail.com> дµÀ£º
> > >
> > > Çë¿´°ïÖú£º
> > >
> > >     Return the reference count of object.  The count returned is
> > > generally
> > >      one higher than you might expect, because it includes the
> > > (temporary)
> > >     reference as an argument to getrefcount() .
> > >
> > > ʹÓÃ1×ö²ÎÊýµÄʱºò£¬Ëü»á¶àÒ»¸ö²ÎÊýÒýÓ㬶øʹÓÃa×ö²ÎÊý£¬Ôò²»»á¶à³öÕâÒ»¸ö²ÎÊýÒýÓá£
> > >
> > > Áí£ºÄãµÄ3¸ösys.getrefcount ()µÄ²ÎÊý¶¼ÊÇ1¡£
> > > ÔÚ 07-10-11£¬leopay< leopay在gmail.com> дµÀ£º
> > > > >>>import sys
> > > > >>>sys.getrefcount(1)
> > > > >>>136
> > > > >>>a=1
> > > >
> > > > >>>sys.getrefcount(1)
> > > > >>>137
> > > >
> > > > >>>sys.getrefcount(1)
> > >
> > > Õâ¸öÓ¦¸ÃÊÇsys.getrefcount(a)
> > >
> > > > >>>136
> > > > Ϊʲôsys.getrefcount(1)ºÍsys.getrefcount (a)µÄ½á¹û²î1£¿
> > > >
> > > >
> > > > _______________________________________________
> > > > 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
> > >
> >
> >
> > _______________________________________________
> > 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
>
-------------- 下一部分 --------------
Ò»¸öHTML¸½¼þ±»ÒƳý...
URL: http://python.cn/pipermail/python-chinese/attachments/20071011/88e3fb0f/attachment.htm 

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

如下红色区域有误,请重新填写。

    你的回复:

    请 登录 后回复。还没有在Zeuux哲思注册吗?现在 注册 !

    Zeuux © 2025

    京ICP备05028076号