<p>After I read that <a href="http://ruby-doc.org/stdlib/libdoc/ostruct/rdoc/classes/OpenStruct.html">OpenStruct</a> <a href="http://mywheel.net/blog/index.php/2008/02/07/ruby-hash-with-method-access/">was now in Ruby core</a>, I had to do it in Python:</p>

<div><pre class="code">class OpenStruct:
	def __init__(self, **dic):
		self.__dict__.update(dic)
	def __getattr__(self, i):
		if i in self.__dict__:
			return self.__dict__[i]
		else:
			raise AttributeError, i
	def __setattr__(self,i,v):
		if i in self.__dict__:
			self.__dict__[i] = v
		else:
			self.__dict__.update({i:v})

o = OpenStruct(b=2)
o.a=1
print o.a,o.b</pre></div>

<p>Will they take it into the Python core? Nooo, but is cool to code nevertheless, and may be used sometimes :)</p>