func_code vs. string problem

Filip Dreger fdreger at amiga.pl
Sun Apr 24 13:01:44 EDT 2005


Uzytkownik "Steven Bethard" <steven.bethard at gmail.com> napisal w 
wiadomosci news:FL2dnap6a5snXPffRVn-1g at comcast.com...
> Any reason you can't define it like:
>
> class actor(object):
>     def __init__(self):
>         self.roles = []
>     def act(self):
>         for role_func in self.roles:
>             role_func(self)
[snip]
> By importing actor, they have full access to the global namespace of 
> the actor.actor object, by simply accessing the actor module 
> attributes.
>
> So the issue here is really about full *local* namespace access.  Do 
> you really need *full* local namespace access?  Why isn't access to 
> the actor.actor instance sufficient?

!!! Yep, of course it is sufficient. Abondoning the obvious 
role_func() must have had some good reasons some time ago, but now I 
can not even remember them, probably they were not so important :-)
Thanks a million,
Filip 





More information about the Python-list mailing list