Raymond Hettinger wrote: > > Here is my cut at the migration and modernization guide. > > Comments are welcome. > > Walter and Neal, would you like to add the somewhat more involved steps for > eliminating the types and strings modules. Here's some more. Note the last one. Martin wanted to make sure this made it into whatsnew. I have already changed a few, one in Bdb I think. I will be changing TclError also. This could be a problem if anyone assumed these exceptions would be string. Neal -- Pattern: import types ; type(v, types.IntType) --> isinstance(v, int) type(s, types.StringTypes --> isinstance(s, basestring) Idea: The types module will likely to be deprecated in the future. Version: 2.2 or greater Benefits: May be slightly faster, avoid a deprecated feature. Locating: grep types *.py | grep import Pattern: import string ; string.method(s, ...) --> s.method(...) c in string.whitespace --> c.isspace() Idea: The string module will likely to be deprecated in the future. Version: 2.0 or greater Benefits: Slightly faster, avoid a deprecated feature. Locating: grep string *.py | grep import Pattern: NewError = 'NewError' --> class NewError(Exception): pass Idea: String exceptions are deprecated, derive from Exception base class. Version: Any Benefits: String exceptions will not work in future versions. Allows except Exception: clause to work. Locating: Use PyChecker
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4