updating local()

Simon Brunning simon.brunning at gmail.com
Thu Oct 6 10:20:24 EDT 2005


On 6 Oct 2005 07:04:08 -0700, Flavio <fccoelho at gmail.com> wrote:
> I know I could pass these variables around as:
>
> def some_function(**variables):
>     ...
>
> some_function(**variables)
>
> but its a pain in the neck to have to refer to them as
> variables['whatever']...
>
> dont you think?

Err, no, not really. ;-)

If you'd prfefer to access them like this:

variables.whatever

Check out the Bunch class here -
<http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/52308>.

--
Cheers,
Simon B,
simon at brunningonline.net,
http://www.brunningonline.net/simon/blog/



More information about the Python-list mailing list