On 4/2/02 1:02 PM, "Tavis Rudd" <[EMAIL PROTECTED]> wrote:
> I've already done it :) > see Setup.py and Component.py in > http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/expwebware/Webware/Webware/ > > I'm still waiting for feedback on it before I do anything more. Those look nice. Some feedback -- I saw in Component.py a lot of code like this:: for k, v in S.items(): if type(v) == DT: S[k] = self._translateDict(v) elif type(v) == LT: S[k] = self._translateList(v) elif type(v) == ST: S[k] = v % S The recommendation now instead of doing 'type(x) is type(a)' is to use 'isinstance(obj, class/type)'. In Python 2.2, it can accept multiple values for the class/type argument, which can catch both traditional and unicode string types, for instance (no pun intended): >>> types.StringTypes (<type 'str'>, <type 'unicode'>) >>> if isinstance('snack', types.StringTypes): ... print "hoorah!" ... hoorah! -- Jeffrey P Shell www.cuemedia.com _______________________________________________ Webware-discuss mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/webware-discuss
