may be a bug in string.rstrip

2007-11-22 Thread kyo guan
Hi : Please look at this code: >>> 'exe.torrent'.rstrip('.torrent') 'ex'<- it should be 'exe', why? but this is a right answer: >>> '120.exe'.rstrip('.exe') '120' <-- this is a right value. there is a bug in the rstr

a question about decorator

2007-10-21 Thread kyo guan
Hi: please look at this code. def A(): print 'warp in A' def why(self, *arg, **kw): print 'in A' print self print arg print kw #self(*arg, **kw) return why class T(obj

why psyco using more memery in liunx?

2007-08-16 Thread kyo guan
Hi all: When you import psyco in python2.5, you can see the memery grow up near 40MB in linux. but the same version python and psyco, is only grow up 1MB under windows. kyo -- http://mail.python.org/mailman/listinfo/python-list

why psyco using more memery in liunx?

2007-08-16 Thread Kyo Guan
Hi all: When you import psyco in python2.5, you can see the memery grow up near 40MB in linux. but the same version python and psyco, is only grow up 1MB under windows. kyo -- http://mail.python.org/mailman/listinfo/python-list

about the implement of the PyString_InternFromString

2006-05-04 Thread Kyo Guan
Hi guys: I have a question about the this API. PyObject * PyString_InternFromString(const char *cp) { PyObject *s = PyString_FromString(cp); if (s == NULL) return NULL; PyString_InternInPlace(&s); return s; } Why it always try to call PyS

about the implement of the PyString_InternFromString

2006-05-04 Thread kyo guan
Hi : Hi guys: I have a question about the this API. PyObject * PyString_InternFromString(const char *cp) { PyObject *s = PyString_FromString(cp); if (s == NULL) return NULL; PyString_InternInPlace(&s); return s; } Why it always try to cal

how not use memmove when insert a object in the list

2006-04-29 Thread kyo guan
Hi : python list object like a stl vector, if insert a object in the front or the middle of it, all the object after the insert point need to move backward. look at this code ( in python 2.4.3) static int ins1(PyListObject *self, int where, PyObject *v) { int i, n = self->ob_siz

how to free the big list memory

2006-04-27 Thread kyo guan
Python version 2.4.3 >>> l=range(50*1024*100) after this code, you can see the python nearly using about 80MB. then I do this >>> del l after this, the python still using more then 60MB, Why the python don't free my memory? Is there any way to force the python free my memory? Thanks. Kyo.

How to Adding Functionality to a Class by metaclass(not by inherit)

2005-08-11 Thread kyo guan
How to Adding Functionality to a Class by metaclass(not by inherit) #example: import inspect class Foo(object): def f(self): pass def g(self): pass class MetaFoo(type): def __init__(cls, name, bases, dic):

How to Adding Functionality to a Class by metaclass(not by inherit)

2005-08-11 Thread Kyo Guan
How to Adding Functionality to a Class by metaclass(not by inherit) #example: import inspect class Foo(object): def f(self): pass def g(self): pass class MetaFoo(type): def __init__(cls, name, bases, dic):

why python on debian without the module profile?

2005-06-13 Thread kyo guan
Hi All: Python 2.4.1 (#2, May 5 2005, 11:32:06) [GCC 3.3.5 (Debian 1:3.3.5-12)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import hotshot,hotshot.stats Traceback (most recent call last): File "", line 1, in ? File "/usr/lib/python2.4/hotshot/stats.py

profile python in embed system

2005-05-22 Thread kyo guan
HI : I want to test my system's performance. My system has a python embed. How can I test the proformance like the python module "profile" or "hotshot" . I can't use the module "profile" because my system are base callback, so I can't run my system like this: profile.run(" "). The

RE: question about the id()

2005-05-15 Thread kyo guan
o that? Thanks. Kyo > -Original Message- > From: Skip Montanaro [mailto:[EMAIL PROTECTED] > Sent: Monday, May 16, 2005 11:09 AM > To: kyo guan > Cc: python-list@python.org > Subject: Re: question about the id() > > > kyo> Can someone explain why the i

question about the id()

2005-05-15 Thread kyo guan
HI ALL: Can someone explain why the id() return the same value, and why these values are changing? Thanks you. Python 2.4.1 (#65, Mar 30 2005, 09:13:57) [MSC v.1310 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> class A(object): ...