Jump to content

  • Log In with Google      Sign In   
  • Create Account

Calling all IT Pros from Canada and Australia.. we need your help! Support our site by taking a quick sponsored surveyand win a chance at a $50 Amazon gift card. Click here to get started!

Tutorial Doctor

Member Since 19 Oct 2013
Offline Last Active Yesterday, 07:08 PM

Posts I've Made

In Topic: "So... What do you do?"

26 August 2015 - 01:30 PM

Q: What do you do?

A: I am a computer programmer


Q: What type of programs?

A: I make games, apps etc...


Q: Oh cool! How do you make games!?

A: Follow me on Twitter @TutorialDoctor



In Topic: Programming scientific GUI's, data and gui layout?

26 August 2015 - 01:24 PM

Lets say I have a class that represents some data (in this example just an array of numbers) I will load from a text file, and store it in an Object data.rawData; Now say I want to double the value of each number. What is the best way to do this?


Python has libraries for data analysis. In this specific case you would use something called list comprehension which can double elements in an array like so:

array = [1,2,3,4,5,6,7,8,9,10]
double = [2*x for x in array]

PyCon is a good resource on lectures for data analysis using Python (You can check youtube for prior events):



This data can be plotted using IPython



And then there is matplotlib:



And numpy:



Maybe this will help?

In Topic: Scrolling background logic?

20 August 2015 - 02:38 PM

Okay. Cool! Thanks!

In Topic: What is a wrapper? What is a Decorator?

14 August 2015 - 01:02 PM

Thanks Tangletail! Nice and easy analogy. And it goes perfectly with my analogy for programming as a whole (a program as a recipe). I am teaching this to kids, and I need to make it very simple.

I guess a wrapper doesn't pretty much the same thing, and a decorator is just a better way to implement it.

In Topic: What is a wrapper? What is a Decorator?

11 August 2015 - 01:38 PM

When you say that it is a piece of code that envelopes existing code, it sounds much like a function inside of a function. Whereas recursion is when a function calls itself, I am supposing a wrapper is the function that calls another function. Or perhaps even, it returns that same function (slightly modified even). 


I am thinking of a programming analogy (code that is analogous to real life) that demonstrates wrappers and decorators. 


They say decorators are syntactic sugar (easier on the eyes?) for wrappers. So a decorator is a "better way" to create a wrapper? Or is it a better way to apply a wrapper? 


Is my idea still correct? Is it a function that calls or returns another function? From my research, it seems there is a broader definition. 

def candy():
    return "candy"

def wrapper():
    return candy()


Yea? If so, how would this become a decorator? Decorate the wrapper with something? Or do we decorate the candy?