Alan,

Just a reminder. I am NOT suggesting the first way to solve a problem is what I 
described. I am saying that sometimes a roadblock (real or imagined) can be 
gotten around using methods like that.

Agreed. There are copyrights that have to be considered, albeit often SMALL 
amounts are considered OK. Attribution is a good idea in general.

The problem that began this is when someone puts roadblocks in the way of what 
works.

If someone for example wants to be able to use something as trivial as math.pi 
but for some reason won't load the math module, you could suggest they look up 
the value of pi to umpteen decimal places and create an object called math 
Perhaps a class) containing nothing but a value called pi ....

This might even satisfy other code they have imported that expects to be able 
to invoke math.pi. But if that other code does an import too, then you might 
need to create an (almost) empty file called math.py containing 
pi=3.1415926535...

Just to make the rest work.

Or, I suggest you can copy the real math module into the same place. You may 
want to edit it with a comment.

But, yes, bad example as pretty much any implementation of python will include 
the math module as it is standard.

Your post does remind me that there are many versions of copyright including 
some with the silly naming of "copyleft" that allow rather free use but with 
limits. They may charge large businesses or government agencies. They may 
demand you leave in some text as in comments or not make changes or notify them 
to get permission so they can keep track or ...

I brought up some questions a while ago that boiled down to how a program can 
know what is already available on the machine the code is being run on. Clearly 
if you use an unfamiliar package, one solution would be to bring the needed 
files with you in the distribution of the program. Yes, it may not be the 
latest or greatest, but you can imagine many ways where it can conditionally 
fall back on the copies included if a regular import fails. 

This may be one reason someone would be asked to limit their code to the 
standard distribution. 



-----Original Message-----
From: Tutor <tutor-bounces+avigross=verizon....@python.org> On Behalf Of Alan 
Gauld via Tutor
Sent: Tuesday, December 4, 2018 6:43 PM
To: tutor@python.org
Subject: Re: [Tutor] Borrowing free code

On 04/12/2018 19:31, Avi Gross wrote:

> But some packages are simply python code that you can simply insert 
> into your own python files.

If they are fully public domain that's probably true.
If they are copyright (even if open/free) you would be potentially liable for 
prosecution since you are copying someone else's work.

Even if it is open source then at the very least you should include a comment 
to the effect that the code is based on, say, M Palin's file parrot.py or 
whatever.

> And, yes, this means you do not get updates if the module changes.

And this is a big drawback for any non trivial code unless you are a 
significantly better programmer than whoever wrote it in the first place. 
(Since understanding somebody else's code is much harder than understanding 
your own!)

--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos


_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to