Fredrik Lundh wrote: > James Stroud wrote: > >> Yes, but I was speaking more consistency than convenience (see above >> for what I mean by consistency). > > why would having access to a type object for exit/quit help you do > proper syntax coloring, btw? if you want to generate a syntax table, > wouldn't it be better to use things like > > issubclass(obj, Exception) > > and > > callable(obj) > > etc. ?
Actually, my code has the first test and the second is a consequence of my checking for types.BuiltinFunctionType. Perhaps the way you suggest is less cumbersome. Food for thought. > (__builtins__ is an implementation detail, btw; OK. I assumed that __builtins__ are somehow sacred regarding what would be reserved. Perhaps not. However, I used __builtins__ to generate a list of reserved words and used types for syntax checking. > if you want a list of > the builtins, import __builtin__ (no plural) and do dir on that). > > </F> cPython, at least, gives this equivalence: py> import __builtin__ py> __builtins__ is __builtin__ True I assume, as you suggest, that one may not depend on this equivalence for all implementations. Thank you for your suggestions, James -- http://mail.python.org/mailman/listinfo/python-list