> From: Delaney, Timothy C (Timothy)=20 >=20 > class Pane (module): # Or whatever - you get the idea ;) >=20 > __slots__ =3D ('background', 'foreground', 'size',=20 > 'content', '__name__', '__file__') > __name__ =3D globals()['__name__'] > __file__ =3D globals()['__file__'] >=20 > background =3D 'black' > foreground =3D 'white' > size =3D (80, 25) >=20 > import sys > sys.modules[__name__] =3D Pane() Hmm ... I was just wondering if we could use this technique to gain the = advantages of fast lookup in other modules automatically (but = optionally). The idea is, the last line of your module includes a call which = transforms your module into a module subclass instance with slots. The functions in the module become methods which access the *class* = instance variables (so they can modify them) but other modules can't. A fair bit of work, and probably not worthwhile, but it's interesting to = think about ;) Tim Delaney
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