Re: [tuxdroid-user] Python API: store() and restore() unused
Status: Beta
Brought to you by:
ks156
From: David B. <da...@ja...> - 2007-05-29 08:57:14
|
I just asked Rémi and he now uses them for the widgets stuff. He changed them somehow but that's still not on svn so better leave that until he commits his changes. AFAIK he changed a lot on the API but unfortunately he doesn't like to use SVN so commits are not regular. On Mon, 28 May 2007 16:35:21 +0200, Martin Thomas <ma...@ma...> wrote: > I would remove them if they are not being used. Why change code that is > being used to support a change in unused code? > > //m > > On Mon, 2007-05-28 at 14:56 +0200, neimad wrote: >> Hello, >> >> I was browsing the Tuxdroïd's Python API and noticed two big functions, >> namely store() and restore(), whose roles are to "save" the contents of >> on_xxx members to s_on_xxx members and copy back s_on_xxx to on_xxx >> later, respectively. >> >> They don't seem to be used anywhere, though, so I'm willing to remove >> them entirely. However, if there's a good reason to keep them, I would >> rewrite them more concisely, something along the lines of: >> >> def store(self): >> members = [m for m in self.__dict__ if m[:3] == "on_"] >> for m in members: >> self.__dict__["saved_" + m] = self.__dict__[m] >> >> def restore(self): >> members = [m for m in self.__dict__ if m[:3] == "on_"] >> for m in members: >> self.__dict__[m] = self.__dict__["saved_" + m] >> >> And maybe even return the "saved" state instead of storing it within >> the object. >> >> This could be applied to clear() as well: >> >> def clear(self): >> for member in self.__dict__: >> if member[:3] == "on_": >> self.__dict__[member] = None >> >> The problem with in doing so is that currently the objects have both >> variables and methods with the same name: on_status and on_status(), >> for example. Thus it would require to rename either of these. >> >> Comments ? >> >> Damien >> >> ------------------------------------------------------------------------- >> This SF.net email is sponsored by DB2 Express >> Download DB2 Express C - the FREE version of DB2 express and take >> control of your XML. No limits. Just data. Click to get it now. >> http://sourceforge.net/powerbar/db2/ >> _______________________________________________ >> tux-droid-user mailing list >> tux...@li... >> https://lists.sourceforge.net/lists/listinfo/tux-droid-user > > > ------------------------------------------------------------------------- > This SF.net email is sponsored by DB2 Express > Download DB2 Express C - the FREE version of DB2 express and take > control of your XML. No limits. Just data. Click to get it now. > http://sourceforge.net/powerbar/db2/ > _______________________________________________ > tux-droid-user mailing list > tux...@li... > https://lists.sourceforge.net/lists/listinfo/tux-droid-user |