On Saturday 19 January 2002 14:42, Mike Orr wrote: > It seems like we can adopt properties and __slots__ piecemeal. > > 1) Add a foo = property(foo, setFoo, None, None) call for each > property. Monitor performance to verify it doesn't go down. If it > doesn't, we're no worse off than we were.
That won't work (or at least the example won't) because the property 'foo' would mask the method 'foo'. > Users can (almost) interchange the old calling scheme with the > new. The "almost" is that there's a name collision between > the get method .foo() and the property .foo . You either have > to rename the get method or let it become inaccessible directly. > > We can't eliminate the accessor methods entirely, because > they're needed to create the property from. Likewise, we > can't eliminate ._fields because we have to store the > dictionary *somewhere*. We could delete the accessor methods > after creating the property, or create the accessor functions > in the constructor (messy?). > > Tavis, can you post the .field algorithm you were considering? ??? I have no idea what you're referring to ;) > 2) Sometime later, migrate the docstrings into the properties. I believe the transition should proceed in one fell swoop if at all. These docstrings a crucial part of the documentation. > 3) Sometime later, add __slots__ . Wait a while for __slots__ to > mature and possibly change. If people write 'self.foa = 1234' > instead of 'self.foo = 1234' in the meantime, they'll be no worse > off than they are under normal Python practice. The current getter/setter method scheme protects against that. > If people will be changing their servlets to eliminate (), it's > better to do it now rather than later when more sites are deployed, > and especially before 1.0. Otherwise, we'll be stuck with > .foo() and .setFoo() forever. I agree. > On the other hand, switching over to properties will require > significant developer work, so it 'tain't gonna happen unless > somebody is sufficiently motivated to do it. I think we need to mull it over for a while yet. > For an easier and smaller change if we don't use properties, note > that Perl programmers use one method for getting and setting. > .foo(newvalue=NotGiven) would eliminate the need for .setFoo and > thus cut down on the multiplicity of accessor methods. -1 _______________________________________________ Webware-discuss mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/webware-discuss
