On Thu, Mar 27, 2003 at 07:35:20PM -0500, Raymond Hettinger wrote: [Raymond proposed this pythonic version of a pragma] > __fastbuiltins__ = True # optimize all subsequent defs in the module > > [Jack Diederich] > > The downside of a pragma module or > > keyword would be what people try to add to it later. > > Ideally, enabling the pragma would also trigger warnings when the > module shadows a builtin. I was thinking that a first-class keyword like pragma no_shadow_builtins would give people a hook to suggest all kinds of nastiness in the future. In your pythonness your suggestion avoided this entirely. We are talking about a very per-module thing, and author's intent. As a progression, how about a subclass of dictionaries that implement warn-on-assign and error-on-assign properties. Having a subclass of dicts specifically for symbol tables has been suggested before and has a wide variety of benefits[1]. This is a good example. -jackdied [1] benefits of a specific 'symtab' type that derives from dict (all variations on 'one stop shop for optimizations') * string-only * assign-once (builtins) * cached lookups
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