From: Mark B. <mb...@0x...> - 2000-04-19 18:00:33
|
On Wed, 19 Apr 2000, Martijn Faassen wrote: > Mark Baker wrote: > So it'll accept both file objects and filenames. > That's overloading it. It's confusing if you can put a filename string into > a function *and* a file object. I'd rather have two differently > named functions, one for the filename string, one for the file object. > Or just the latter; it's trivial to do an open() myself, after all. Yes, it will accept both filenames and file-like objects. If you don't want to supply filenames, then you don't have to. > > For languages like C++, function overloading using different types is common > > place. Though these are through seperate functions, in C++, the internal > > representation to the user of PySDL isn't overly important. > > I know C++ allows stuff like this, but that doesn't mean we should > apply it here. :) I think it pollutes the API to do this, and it just > doesn't seem necessary. I understand it already works like that, so in > that case I'm complaining about the current functionality (I haven't > experimented with it yet). Python also allows for this as well, in a somewhat less 'clean' manner, via type() and the types module. Inspecting an object for read, write, seek, etc methods is no more type pure, either. Does anyone else feel strongly against this? I could change it, I simply see no real reason to. I would simply remove the ability to load from a filename entirely, and leave it to people to manage their files. Seems pointless to me, but I'd like to hear what the consensus is first. |