Objects in Python

Roy Smith roy at panix.com
Sun Aug 26 09:41:07 EDT 2012


In article <mailman.3830.1345962128.4697.python-list at python.org>,
 Chris Angelico <rosuav at gmail.com> wrote:

> On Sun, Aug 26, 2012 at 3:45 PM, Evan Driscoll <driscoll at cs.wisc.edu> wrote:
> > Third, and more wackily, you could technically create a C implementation
> > that works like Python, where it stores variables (whose addresses aren't
> > taken) in a dict keyed by name, and generates code that on a variable access
> > looks up the value by accessing that dict using the name of the variable.
> 
> That would be a reasonable way to build a C interactive interpreter.

Except that lots of C and C++ programs assume they know how data 
structures are laid out and can index forward and backward over them in 
ways which the language does not promise work (but are, none the less, 
useful).  Say, the sort of thinks you might use python's struct module 
for.

On the other hand, there is certainly a big subset of C that you could 
implement that way.  But it would only be useful as a simple 
instructional tool.



More information about the Python-list mailing list