On 2/15/06, M.-A. Lemburg <mal at egenix.com> wrote: > Barry Warsaw wrote: > > On Wed, 2006-02-15 at 18:29 +0100, M.-A. Lemburg wrote: > > > >> Maybe a weird idea, but why not use static methods on the > >> bytes and str type objects for this ?! > >> > >> E.g. bytes.openfile(...) and unicode.openfile(...) (in 3.0 > >> renamed to str.openfile()) > > > > That's also not a bad idea, but I'd leave off one or the other of the > > redudant "open" and "file" parts. E.g. bytes.open() and unicode.open() > > seem fine to me (we all know what 'open' means, right? :). > > Thinking about it, I like your idea better (file.bytes() > and file.text()). This is better than making it a static/class method on file (which has the problem that it might return something that's not a file at all -- file is a particular stream implementation, there may be others) but I don't like the tight coupling it creates between a data type and an I/O library. I still think that having global (i.e. built-in) factory functions for creating various stream types makes the most sense. -- --Guido van Rossum (home page: http://www.python.org/~guido/)
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