Popular recipes by Ikkei Shimomura http://code.activestate.com/recipes/users/987178/2008-10-26T19:35:13-07:00ActiveState Code Recipesmake dictproxy object via ctypes.pythonapi and type() (Python) 2008-10-26T19:35:13-07:00Ikkei Shimomurahttp://code.activestate.com/recipes/users/987178/http://code.activestate.com/recipes/576540-make-dictproxy-object-via-ctypespythonapi-and-type/ <p style="color: grey"> Python recipe 576540 by <a href="/recipes/users/987178/">Ikkei Shimomura</a> . Revision 2. </p> <p>Python internal has type 'dictproxy'.</p> <p>You can get the dictproxy type object in Python.</p> <p>from types import DictProxyType</p> <p>any new-style classes has a __dict__ attribute, it's the dictproxy object. but, the type constructor disallow you to make the instance.</p> <p>DictProxyType({}) # TypeError</p> <p>This recipe explains how to make dictproxy object via Python API ... and type() more easy way</p> lexical variables in with-statement (Python) 2007-05-18T06:52:34-07:00Ikkei Shimomurahttp://code.activestate.com/recipes/users/987178/http://code.activestate.com/recipes/520586-lexical-variables-in-with-statement/ <p style="color: grey"> Python recipe 520586 by <a href="/recipes/users/987178/">Ikkei Shimomura</a> (<a href="/recipes/tags/programs/">programs</a>). </p> Evaluate upper-letters variable name as constants at compile time. (Python) 2005-07-12T10:27:09-07:00Ikkei Shimomurahttp://code.activestate.com/recipes/users/987178/http://code.activestate.com/recipes/435694-evaluate-upper-letters-variable-name-as-constants-/ <p style="color: grey"> Python recipe 435694 by <a href="/recipes/users/987178/">Ikkei Shimomura</a> (<a href="/recipes/tags/programs/">programs</a>). Revision 2. </p> <p>This code converts variables which is made with upper-leters only, into constants at compile time, if it is possible to be replaced. and generate .pyc file.</p> <p>This recipe pay attensions to the compile time evaluation, the feature of Constants.</p> A meta-class that provides class behavior like Ruby (Python) 2004-12-29T19:37:12-08:00Ikkei Shimomurahttp://code.activestate.com/recipes/users/987178/http://code.activestate.com/recipes/361167-a-meta-class-that-provides-class-behavior-like-rub/ <p style="color: grey"> Python recipe 361167 by <a href="/recipes/users/987178/">Ikkei Shimomura</a> (<a href="/recipes/tags/oop/">oop</a>). </p> <p>It brings Ruby-like class behavior. When a class is declared, it extends the old class if the class name exists already.</p>