how to detect if an object is "simple" (not a pointer, unmutable ) ?

Stef Mientki stef.mientki at gmail.com
Tue Feb 17 08:58:24 EST 2009


hello,

I'm making a virtual machine,
in which (small) pieces of software (called bricks) are connected,
by connecting an output of a brick to the input of another brick.

A connection between 2 bricks may be of any type,
so it might be simple integer,
or a multi-nested dictionary / list or whatsoever .

Connections are made with the following statement (in simplified form)

Brick2.In = Brick2.Out

Now if the connection is a complex object, e.g. a list,
Brick2.In and Brick2.Out points to the same object,
and can automatically exchange information.

Now if the connection consists of a simple integer,
the statement Brick2.In = Brick2.Out
just assigns once a value to Brick2,
so there's no real communication anymore.
I solved that by adding modify-flags and receiver lists.

The problem is how can I determine
if a connection is a pointer or not ?
Which I'm not sure might be the same as mutable ?
( The type of connection need not be a standard Python type,
but might be any type created by the user. )

thanks,
Stef Mientki






More information about the Python-list mailing list