Re: Can't seem to start on this

Discussion in 'Python' started by Kene Meniru, Jan 3, 2013.

  1. Kene Meniru

    Kene Meniru Guest

    D'Arcy J.M. Cain 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:

    SnapSize(num)

    > In file B:
    >
    > class TopClass(object):
    > def __init__(self, snap_size, var1 = None, var2 = None):
    > self.snap_size = snap_size
    > self.var1 = var1
    > if var2 is None: self.var2 = 7
    > self.var3 = "GO"
    > self.var4 = "Static string"
    >
    > *add class methods here*
    >
    > In file A:
    >
    > class MyClass(TopClass):
    > def __init__(self, var1):
    > TopClass.__init__(self, 10, var1, 8)
    > self.var3 = "STOP"
    >
    > x = MyClass(42)
    > x.var4 = "Not so static after all"
    >


    As I mentioned, the file "A" can be considered a scene file. I do not want
    the user to have to create classes there. I apologize for the lack of code.
    I will soon have some python code so my future questions will have some
    examples.

    Thanks for the comments.
    Kene Meniru, Jan 3, 2013
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Kene Meniru

    Can't seem to start on this

    Kene Meniru, Jan 3, 2013, in forum: Python
    Replies:
    0
    Views:
    172
    Kene Meniru
    Jan 3, 2013
  2. Mitya Sirenef

    Re: Can't seem to start on this

    Mitya Sirenef, Jan 3, 2013, in forum: Python
    Replies:
    0
    Views:
    173
    Mitya Sirenef
    Jan 3, 2013
  3. Kene Meniru

    Re: Can't seem to start on this

    Kene Meniru, Jan 3, 2013, in forum: Python
    Replies:
    0
    Views:
    126
    Kene Meniru
    Jan 3, 2013
  4. Mitya Sirenef

    Re: Can't seem to start on this

    Mitya Sirenef, Jan 3, 2013, in forum: Python
    Replies:
    0
    Views:
    140
    Mitya Sirenef
    Jan 3, 2013
  5. Kene Meniru

    Re: Can't seem to start on this

    Kene Meniru, Jan 3, 2013, in forum: Python
    Replies:
    0
    Views:
    160
    Kene Meniru
    Jan 3, 2013
Loading...

Share This Page