Movatterモバイル変換


[0]ホーム

URL:


[Python-Dev] Second round: arbitrary function and method attributes

bwarsaw@cnri.reston.va.usbwarsaw@cnri.reston.va.us
Wed, 12 Apr 2000 11:56:18 -0400 (EDT)


>>>>> "GS" == Greg Stein <gstein@lyra.org> writes:    GS> In the instancemethod_setattro function, it might be nice to    GS> do the speed optimization and test for sname[0] == 'i' before    GS> hitting the strcmp() calls.Yeah, you could do that, but it complicates the code and the win seemsnegligable.    GS> Oh: policy question: I would think that these attributes    GS> *should* be available in restricted mode. They aren't "sneaky"    GS> like the builtin attributes.Hmm, good point.  That does simplify the code too.  I wonder if the__dict__ itself should be restricted, but that doesn't seem like itwould buy you much.  We don't need to restrict them in classobjectanyway, because they are already restricted in funcobject (which endsup getting the call anyway).  It might be reasonable to relax that forarbitrary func attrs.    GS> Rather than    GS> PyMapping_Get/SetItemString()... PyObject_Get/SetItem() should    GS> be used. They apply to mappings and will be faster. Note that    GS> (internally) the PyMapping_Get/SetItemString use the latter    GS> forms (after constructing a string object(!)).  ... whoops. I    GS> see that the function object doesn't use the ?etattro()    GS> variants. hrm.Okay cool.  Made these changes and `attro'd 'em too.    GS> The stuff is looking really good!Thanks!-Barry


[8]ページ先頭

©2009-2025 Movatter.jp