On Fri, 14 Apr 2000, Vladimir Marangozov wrote: > If you prefer embedded definitions, among other things, you could do: > > __zope_access__ = { 'Spam' : 'public' } > > class Spam: > __zope_access__ = { 'eggs' : 'private', > 'eats' : 'public' } > def eggs(self, ...): ... > def eats(self, ...): ... This solution is close to what the eff-bot suggested. In this case it is horrible because of "editing effort": the meta-data and code of a function are better off together physically, so you would change it to class Spam: __zope_access__ = {} def eggs(self): pass __zope_access__['eggs'] = 'private' def eats(self): pass __zope_access__['eats'] = 'public' Which is way too verbose. Especially, if the method gets thrown around, you find yourself doing things like meth.im_class.__zope_access__[meth.im_func.func_name] Instead of meth.__zope_access__ And sometimes you write a function: def do_something(self): pass And the infrastructure adds the method to a class of its choice. Where would you stick the attribute then? -- Moshe Zadka <mzadka@geocities.com>. http://www.oreilly.com/news/prescod_0300.html http://www.linux.org.il -- we put the penguin in .com
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