From Barry's discussion of the problem of "magic strings" as arguments to .encode / .decode , I was reminded of a blog entry, http://www.brunningonline.net/simon/blog/archives/000803.html which mentions another case of "magic strings" that might perhaps be (optionally but suggestedly) changed into more-readable attributes (in this case, clearly attributes of the 'file' type): mode arguments to 'file' calls. Simon Brunning, the author of that blog entry, argues that myFile = file(filename, 'rb') (while of course we're going to keep accepting it forever) is not quite as readable and maintainable as, e.g.: myFile = file(filename, file.READ + file.BINARY) Just curious -- what are everybody's feelings about that idea? I'm about +0 on it, myself -- I doubt I'd remember to use it (too much C in my past...:-) but I see why others would prefer it. Another separate "attributes of types" issue raised by that same blog entry -- and that one does find me +1 -- is: isn't it time to make available as attributes of the str type object those few things that we still need to 'import string' for? E.g., the maketrans function (and maybe we could even give it a better name as long as we're making it a str.something?)... Alex
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