Question about coding "ethics and morals"

Greetings. I have been self-practicing and studying Python for a couple of years now.
This year I started to notice that I actually really understand what I’m doing and coding and since then I have followed a path “code only what you understand”.

So I have completely stopped copy pasting and replaced that method with studying various sources and codes other people have written and gone through tutorials, API pages, etc… After I have learned and understood the material I have rewritten the code from scratch the way I see it myself.

My question is:
If for example I take a mouselook script from this forum, I study it from bottom up how it works and what it really does.
Then after that I rewrite the code all by myself from beginning not even giving a look at the original material. The code
I write only faintly resembles the material I learned the stuff from, since of course I write code that is built for my needs and works quite differently.

Should I feel obligated to credit the original coder or should this be only the case when I clearly have copy&paste’d someone’s code?

I am having a hard time thinking “selfishly” and to admit myself that I actually can do something on my own, and I struggle with a feeling that I owe those from who I learned things from. Not sure if someone else is having a same feeling at times.

You can mention your “teachers” if you want. But as you wrote the code on your own, you have all rights by yourself.

Regardless of that, it is surely not a bad idea to add a thank you list to your final work (similar to books). It is up to you if you thank your English teacher that you are able to write complete sentences or the pizza boy that you didn’t died because of hunger.

BTW. I suggest to read PEP#008 for some good style hints. You will see that most of the posted code uses “random” style ;).

You might consider saying a particular Python script was “inspired by” someone else’s. I went through something similar a while ago and, I must admit, I haven’t released the code because of similar feelings. It was a little different in my case, though. I contacted the original author about a collaboration but, after a few back-and-forth messages, I never heard from him again. As it turned out, a third person wrote something similar as well and has released it, making the whole thing pretty much moot.

But at least I have the satisfaction of having written the code as well as having it in my toolbox. Given the same circumstances again, I think I would go the “inspired by” route and just post it here. I don’t know if that’s the moral thing to do, but it seems reasonable to me.

A favourite quote of mine (from Crouching Tiger, Hidden Dragon) is ‘‘No growth without assistance’’ along with '‘Standing on the Shoulder of Giants’'​.

We all to a greater or lesser extent learn from those who went before us, and many things posted here have been done before.

Giving thanks to those who gave you understanding is to me polite, and (being one of those ‘random’ code generators Monster talks about) the right thing to do, even if it is just inspiration.

As an example, Monster coded a way to select objects for me. Later, when I had to re-make certain sections of my game I looked at the script, took three lines from a related help post and made an entirely new script based on what I could do myself with Python.

Without Monster, the seed of an idea would never have formed, so it was only right he had a credit from me.


I am having a hard time thinking “selfishly” and to admit myself that I actually can do something on my own, and I struggle with a feeling that I owe those from who I learned things from. Not sure if someone else is having a same feeling at times.

If you feel the need to mention someone, just mention them - it can’t hurt, and it won’t detract anything from your accomplishment, because everyone can see that it’s not the same exact code.

Yea, but don’t think of it as “law”: I don’t see how this_function_name is better style than thisFunctionName. Also, the whole “tabs vs spaces” argument seems like a failure to recognize that TAB width is user defined, and that it’s therefore a superior indentation method, because it can be customized to whatever the programmer prefers.

If it were an image the answer would be yes if it is copyrighted by an author. We just went over this issue with our licensing manager. Just because you have the ability to re-create something does not give you the right to claim it as your own or not pay licensing fee to the copyright holder.

Just think of it as a song. If you take the Rolling Stones ‘Start Me Up’ and change it around to ‘Start Me Now’ you are still infringing on the copyright. Lets say you go even further and shift it into another key and change the tempo and now it sounds Latin. Lets also say you worked real hard on it for a long time so you feel like you own it now. When you go to publish the work is when you will face the real challenge.

Code lies behind the scenes, however, so it is not as easy to recognize. But if you follow the news you will see that big companies are suing each other all the time over copyright infringement or technologies that they thought they held patents to but really should be paying licensing fees.

I am sorry you can not sleep at night because of IF/THEN/ELSE.:stuck_out_tongue:

I’ll start by saying that tearing apart a script and experimenting with it is a great way to learn. You have an expectation of how the script should originally work, so you start changing parts of it to see what difference they make. This is how I started learning Python; I took apart the mouselook script from and wrote my own custom script based on what I learned, and added to it what I needed.

You aren’t necessarily required to give any sort of credit if the code is all written by yourself. But as others have said, a simple “Special thanks to…” section couldn’t hurt. It might make a few people glad that they were able to help someone in some way :wink: