An empty object with dynamic attributes (expando)

Aahz aahz at pythoncraft.com
Wed Jun 9 22:31:29 EDT 2010


In article <86beb1fe-36ec-4a89-b926-3bb227c09a6f at g39g2000pri.googlegroups.com>,
dmtr  <dchichkov at gmail.com> wrote:
>
>>>> m = lambda:expando
>>>> m.myattr = 1
>>>> print m.myattr
>1

That's a *great* technique if your goal is to confuse people.
-- 
Aahz (aahz at pythoncraft.com)           <*>         http://www.pythoncraft.com/

"If you don't know what your program is supposed to do, you'd better not
start writing it."  --Dijkstra



More information about the Python-list mailing list