Michael Hudson wrote: > James Y Knight <foom at fuhm.net> writes: >>IMO classes ought to actually appear in __builtin__ if they claim they >>are defined there. Doing otherwise breaks reflection, as you have to >>add a special case for these class names to use the appropriate object >>from the types module instead. Thoughts? If it isn't desirable to have >>these names appear in __builtin__, perhaps their '__module__' should >>be changed to another module where they are defined? > > > Such as? There really isn't a module where e.g. GeneratorType is > defined. > Seems perfectly reasonable and useful to add GeneratorType and others to the types module. I have code, for example, like this, in a couple places: def _getACell(o): x = o def y(): y = x return [o for o in gc.get_referrers(x) if type(o).__name__ == 'cell'][0] def _f(): types.CellType = type(_getACell(object())) _f() Jp
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