Tue, 01 Dec 2009 18:58:25 -0500, bearophile wrote: > Rainer Deyke: >> "open" by itself is ambiguous. What are you opening? A window? A >> network port? I think the word "file" needs to be in there somewhere >> to disambiguate. > > When you program in Python you remember that open is a built-in function > to open files :-) When you want to open other things you import other > names from some module. So this ambiguity usually doesn't introduce > bugs. It' a well known convention. Few well chosen conventions (sensible > defaults) save you from a lot of useless coding.
These default values are sometimes very annoying. For instance almost in every game you have a game object hierarchy and the super class of game objects usually conflicts with built-in 'Object'. If I write an adventure game and some event opens a dungeon door, open() suddenly deals with files. Also IIRC Python has built-in print() command. What if I want to redefine this to mean printing to a graphical quake like game console. Namespaces in general seem rather useful. I hate the php like 'there's a flat global scope and everything is a free function approach'. It's annoying me each time I use phobos.