> Guido van Rossum wrote: > > >>Sooo should (for 'generator' in objects that claim to be in > >>__builtins__ but aren't), > >>1) 'generator' be added to __builtins__ > >>2) 'generator' be added to types.py and its __module__ be set to 'types' > >>3) 'generator' be added to <newmodule>.py and its __module__ be set to > >>'<newmodule>' (and a name for the module chosen) > > > > I guess (1). [Note: it should be added to __builtin__, not __builtins__ -- the two are related but __builtin__ is the module and __builtins__ is a secret attribute that references the module or its __dict__ for purposes of sandboxing. [Brett C] > The problem I see with explicitly adding this stuff to __builtins__ > is that tab-completion in the interpreter is suddenly going to have > all of this extra stuff that people are not going want to really see > that often. There's already lots of stuff there that's rarely used. > The other point I would like to make is that almost everything in > __builtins__ is either an exception, a singleton (thinking of True > and False), or a function (even thinking of list and dict since you > can use their factory methods). But list and dict are *not* functions, they are types, and they can be used for subclassing and type checking too. These are the precedent for placing generator etc. in __builtin__. > The only exceptions I can think of are __name__ and that is just > part of the design. Throwing in generator and any of the other > types that are defined by the built-in types will go against all of > this unless we create factory methods for them which is not really > desired since they are returned only in certain situations. They should not be made factory functions if they aren't already. > I personally prefer option 2. Bah. The types module shouldn't be the "home" for any types -- it's just a collection of convenient aliases, and mostly they have the wrong names. It should be deprecated. Also note that at least 6 of these "anonymous" built-in types currently have another alias in the 'new' module, which means that they *are* factories already. It would be nice if that module could finally be deprecated. --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