Paul Rubin wrote: > Steven D'Aprano <steve at REMOVETHIScyber.com.au> writes: > >>>2) Allow the client access to these private variables, through >>>a special construct. Maybe instead of "from ... import ..." >>>"from ... spy ...". >> >>What you are suggesting is that you have private variables that are only >>private by convention, since anyone can simply call use spy to treat >>them as public. > > > This notion isn't so bad, if there's way for modules to notice when > they're spied on, like an import hook, e.g.: > > def __spy__(othermodule, symbol_list): > # this gets called when another module spies on symbols > > It's like a runtime version of C++'s "friend" declaration. Well, not > quite as good, it's like having some stranger slide over to you in a > bar and say "I wanna be your friend". But at least it's better than > not finding out at all where the external references are. Oh, great, so now I have to code my classes so they know what to do when someone starts spying on them. Don't you have work to do? regards Steve -- Steve Holden +44 150 684 7255 +1 800 494 3119 Holden Web LLC www.holdenweb.com PyCon TX 2006 www.python.org/pycon/
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