Can't seem to start on this

D'Arcy J.M. Cain darcy at
Thu Jan 3 15:30:15 CET 2013

On Thu, 03 Jan 2013 09:06:55 -0500
Kene Meniru <Kene.Meniru at> wrote:
> > OK, "global variables" is the clue that you need to rethink this.
> > Try to stay away from global variables as much as possible except
> > for maybe some simple setup variables within the same file.
> > Consider something like this instead.
> > 
> The global variable is not part of the LinearMark object. It will be
> used by ALL objects created. I understand the uneasiness with this so
> maybe I will make it a function so it will be set with something like:

Applying to all objects in your file A is not an issue.  See below.

> SnapSize(num)

That doesn't make it any less global.

> As I mentioned, the file "A" can be considered a scene file. I do not

I don't know what a "scene" file is.

> want the user to have to create classes there. I apologize for the

But you expect them to write Python code?  Classes are a very powerful
part of Python and if super classes are written well they can be very
simple to write.  Perhaps you found my examples too complicated.  That
was so I could illustrate a number of methods.  I wouldn't expect you
to use all of them in your code.  Here is a simpler example that may
meet your requirements.

File B:

class TopClass(object):
  def __init__(self, snap_size):
    self.snap_size = snap_size

  def put(self, ...

In file A:

class MyClass(TopClass):
  def __init__(self):
    TopClass.__init__(self, 10)

x = MyClass()

Now you have a new class where every instance uses a snap size of 10.
Notice that this class in what you call the user's code is only three
lines.  That's pretty simple for your "user."

If you think that that is too complicated still then maybe the user
shouldn't be writing any Python code and instead look at the various
ways of parsing configuration files which they can write.

D'Arcy J.M. Cain <darcy at>         |  Democracy is three wolves                |  and a sheep voting on
+1 416 425 1212     (DoD#0082)    (eNTP)   |  what's for dinner.
IM: darcy at Vex.Net

More information about the Python-list mailing list