Thread: Best way to structure a python program?

  1. #1
    Registered User camel-man's Avatar
    Join Date
    Jan 2011
    Location
    Under the moon
    Posts
    693

    Best way to structure a python program?

    For anyone that is familiar with the Python language, could you tell me what the best way to structure a program would be? For example in a functional way like C or an object oriented way like C++?

    I've never worked with Python before and am trying to write a program dealing with a Finite state machine.
    Code:
    int get_random_number(void)
    {
       return 4; //chosen by fair dice roll.
                 //guaranteed to be random
    }

  2. #2
    Registered User
    Join Date
    Oct 2006
    Posts
    3,445
    Quote Originally Posted by camel-man View Post
    For example in a functional way like C or an object oriented way like C++?
    Python is a multi-paradigm language, much like C++. You are free to do whatever works best for your application. A finite state machine can be implemented with OO or Procedural code. It's entirely up to you.
    What can this strange device be?
    When I touch it, it gives forth a sound
    It's got wires that vibrate and give music
    What can this thing be that I found?

  3. #3
    Make Fortran great again
    Join Date
    Sep 2009
    Posts
    1,413
    https://www.python.org/dev/peps/pep-0008/ may be useful/of interest if you're just starting with Python

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Difference between Python 2 and Python 3?
    By OMG its Ali in forum Tech Board
    Replies: 3
    Last Post: 03-18-2014, 08:06 PM
  2. Replies: 4
    Last Post: 11-22-2006, 12:20 PM
  3. Structure of a C++ program.
    By CrazYjoe in forum C++ Programming
    Replies: 3
    Last Post: 10-05-2006, 06:07 AM
  4. structure program
    By prlove71 in forum C++ Programming
    Replies: 1
    Last Post: 03-08-2002, 09:01 PM
  5. more with my 1st structure program
    By sballew in forum C Programming
    Replies: 42
    Last Post: 10-22-2001, 08:03 PM