Martijn Faassen wrote: > jason kirtland wrote: > [snip] >>> Could the check somehow be modified to still find true builtins but not >>> those defined in a doctest? >> Sure. Any suggestions for an alternate check? > > Heh, no. It's quite difficult to come up with any alternative.. > > I wonder why doctest.DocFileSuite makes these classes appear as __builtin__. > > I just went digging in doctest, but unfortunately this seems to be an > unavoidable side effect of the behavior of the 'exec' statement, which > doctest uses. > > I've just did some experiments, but whatever I do, any class definition > I exec ends up with a __module__ set to __builtin__.
I think that comes from __name__ in the exec globals context: >>> d = {'__name__': 'foo'} >>> exec 'class Quux(object): pass' in d >>> d['Quux'].__module__ 'foo' or >>> __name__ = 'bar' >>> class O(object): pass ... >>> O.__module__ 'bar' --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlalchemy@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~----------~----~----~----~------~----~------~--~---