2004年08月10日 星期二 17:06
了解了,我来试试 On Tue, 10 Aug 2004 14:50:42 +0800,
wrote: > Hollo HD: > > 咦咦咦??不是说过了?? > 按照在下的 config.py 依法处理就好的? > 关键的:: > > # permissions > > from MoinMoin.security import Permissions > class SecurityPolicy(Permissions): > def edit(self, pagename, **_): > # only known users are allowed to delete > return self.user.valid > > 其中 **_ 是个正则表达式,可以更进一步限定的! > 中蟒,就是如此干的! > > /******** [2004-08-10]14:47:49 ; HD wrote: > > HD> 呵呵,在哪里设置呀,怎么设置?zoom.q呀,说说。有人在追我了。 :) > > ********************************************/ > > -- > Free as in Freedom > > Zoom.Quiet > > #=========================================# > ]Time is unimportant, only life important![ > #=========================================# > > sender is the Bat!2.12.00 > > _______________________________________________ > python-chinese list > python-chinese at lists.python.cn > http://python.cn/mailman/listinfo/python-chinese > -- HD(燃烧中的火) 我工作我快乐,我勤奋我收获。请与我一起快乐,与我一起收获。
2004年08月10日 星期二 17:24
gentoo.cn,您好! 我想这个东西大概估一下就好了。如果想严格控制,还不如做成扩展库来的方便呢。用C或其它可以对内存控制的语言编一个扩展库,在python中再进行调用好了。毕竟不会要求,什么东西都考虑内存吧。只有在关键的地方才会考虑吧。 ======= 2004-08-10 16:38:23 您在来信中写道:======= >一般来说,使用python, java这样有gc的程序时不用关心内存分配(memory killer) >但是,有的应用场合可能你需要关心object的大小 >比如:类似于Zope这样的Object容器里的Cache, 太大的Object不要放到Cache里来 > >抑或,有个叫pythonOS的东东里可能也需要哦。 > >limodou wrote: > >>Zoom.Quiet,您好! >> >> 也不至于要细到要知道内存大小。 >> >>======= 2004-08-10 15:54:28 您在来信中写道:======= >> >> >> >>>Hollo limodou: >>> >>> 不能说不关心哪?! >>>Python 在嵌入设置中也有移植的!性能的追求是一切语言不能忽略的是也乎,不过 Python 以另外的方式来完成,当然也有提高的余地,有忐者可以开始探险哪!? >>> >>> >>>/******** [2004-08-10]15:52:50 ; limodou wrote: >>> >>>limodou> tocer,您好! >>> >>>limodou> 因为使用Python根本不关心这个。不要总把C/C++里的概念在Python中使用,因为它们根本就不一样。 >>> >>>limodou> ======= 2004-08-10 15:33:00 您在来信中写道:======= >>> >>> >>> >>>>>没想到这么难解决 >>>>> >>>>>----- Original Message ----- >>>>>From: "gentoo.cn" <gentoo.cn at 126.com> >>>>>To: <python-chinese at lists.python.cn> >>>>>Sent: Tuesday, August 10, 2004 12:53 PM >>>>>Subject: Re: [python-chinese] 如何测量一个变量或者常量在内存中的大小 >>>>> >>>>> >>>>> >>>>> >>>>>>找到一个相关的讨论 >>>>>>http://www.egenix.com/mailman-archives/egenix-users/2002-November/000156.html >>>>>> >>>>>>gentoo.cn wrote: >>>>>> >>>>>> >>>>>> >>>>>>>我的意思是:是不是可以通过计算一个Object的Struct来猜测这个Object的大小? >>>>>>>比如c='a', string="abcd" >>>>>>>那么c的类型是1c, string的类型是4c >>>>>>>calcsize('c')=1 >>>>>>>calcsize('L')=4 >>>>>>>也就是说一个数值型的对象占用4Bytes内存空间,一个字符型对象占用1Bytes内存 >>>>>>>空间? >>>>>>>对于string="abcd"这个对象,类型是4c所以占用4Bytes内存空间? >>>>>>>不知道Python如何考虑对齐的(也许他最小的单位是1Bytes所以都是8bit的倍数, >>>>>>>这样就对齐了?) >>>>>>> >>>>>>>大家都来讨论讨论啊。 >>>>>>> >>>>>>> >>>>>>> >>>>>>>limodou wrote: >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>>>gentoo.cn,您好! >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>那个不是内存的大小吧。而是对应的struct的大小。因为在python中都是对象,而不仅仅是数据结构。不知道:你想知道内存大小有什么用? >>>>>> >>>>>> >>>>>>>>======= 2004-08-10 11:05:42 您在来信中写道:======= >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>>>import struct >>>>>>>>>struct.pack >>>>>>>>>struct.calcsize ? >>>>>>>>> >>>>>>>>>难道使用这个方法吗? >>>>>>>>>我也想知道有什么方法来计算对象的size >>>>>>>>> >>>>>>>>>*calcsize*( fmt) >>>>>>>>> >>>>>>>>> Return the size of the struct (and hence of the string) >>>>>>>>> corresponding to the given format. >>>>>>>>> >>>>>>>>>Format characters have the following meaning; the conversion between C >>>>>>>>>and Python values should be obvious given their types: >>>>>>>>> >>>>>>>>>*Format* *C Type* *Python* *Notes* >>>>>>>>>x pad byte no value >>>>>>>>>c char string of length 1 >>>>>>>>>b signed char integer >>>>>>>>>B unsigned char integer >>>>>>>>>h short integer >>>>>>>>>H unsigned short integer >>>>>>>>>i int integer >>>>>>>>>I unsigned int long >>>>>>>>>l long integer >>>>>>>>>L unsigned long long >>>>>>>>>q long long long (1) >>>>>>>>>Q unsigned long long long (1) >>>>>>>>>f float float >>>>>>>>>d double float >>>>>>>>>s char[] string >>>>>>>>>p char[] string >>>>>>>>>P void * integer >>>>>>>>> >>>>>>>>> >>>>>>>>>tocer wrote: >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>>>比如: >>>>>>>>>>a=[1,2,3] >>>>>>>>>>测试 a 在内存中的所占的字节数 >>>>>>>>>> >>>>>>>>>>------------------------------------------------------------------------ >>>>>>>>>> >>>>>>>>>>_______________________________________________ >>>>>>>>>>python-chinese list >>>>>>>>>>python-chinese at lists.python.cn >>>>>>>>>>http://python.cn/mailman/listinfo/python-chinese >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>_______________________________________________ >>>>>>>>>python-chinese list >>>>>>>>>python-chinese at lists.python.cn >>>>>>>>>http://python.cn/mailman/listinfo/python-chinese >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>= = = = = = = = = = = = = = = = = = = = >>>>>>>> >>>>>>>> >>>>>>>> 致 >>>>>>>>礼! >>>>>>>> >>>>>>>> >>>>>>>> limodou >>>>>>>> chatme at 263.net >>>>>>>> 2004-08-10 >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>>------------------------------------------------------------------------ >>>>>>>> >>>>>>>>_______________________________________________ >>>>>>>>python-chinese list >>>>>>>>python-chinese at lists.python.cn >>>>>>>>http://python.cn/mailman/listinfo/python-chinese >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>_______________________________________________ >>>>>>>python-chinese list >>>>>>>python-chinese at lists.python.cn >>>>>>>http://python.cn/mailman/listinfo/python-chinese >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>_______________________________________________ >>>>>>python-chinese list >>>>>>python-chinese at lists.python.cn >>>>>>http://python.cn/mailman/listinfo/python-chinese >>>>>>_______________________________________________ >>>>>> >>>>>> >>>>>python-chinese list >>>>>python-chinese at lists.python.cn >>>>>http://python.cn/mailman/listinfo/python-chinese >>>>> >>>>> >>>>> >>>limodou> = = = = = = = = = = = = = = = = = = = = >>> >>> >>>limodou> 致 >>>limodou> 礼! >>> >>> >>>limodou> limodou >>>limodou> chatme at 263.net >>>limodou> 2004-08-10 >>> >>> >>> >>>********************************************/ >>> >>>-- >>>Free as in Freedom >>> >>>Zoom.Quiet >>> >>>#=========================================# >>>]Time is unimportant, only life important![ >>>#=========================================# >>> >>>sender is the Bat!2.12.00 >>> >>>_______________________________________________ >>>python-chinese list >>>python-chinese at lists.python.cn >>>http://python.cn/mailman/listinfo/python-chinese >>> >>> >>> >> >>= = = = = = = = = = = = = = = = = = = = >> >> >> 致 >>礼! >> >> >> limodou >> chatme at 263.net >> 2004-08-10 >> >> >> >>------------------------------------------------------------------------ >> >>_______________________________________________ >>python-chinese list >>python-chinese at lists.python.cn >>http://python.cn/mailman/listinfo/python-chinese >> >> > >_______________________________________________ >python-chinese list >python-chinese at lists.python.cn >http://python.cn/mailman/listinfo/python-chinese > = = = = = = = = = = = = = = = = = = = = 致 礼! limodou chatme at 263.net 2004-08-10
Zeuux © 2025
京ICP备05028076号