osdir.com


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Aw: Re: stuck on time


On 9/12/19 7:47 AM, RobH wrote:
> On 08/12/2019 16:49, Dennis Lee Bieber wrote:
>> On Sun, 8 Dec 2019 09:44:54 +0000, RobH <rob at despammer.com> declaimed the
>> following:
>>> def print_time():
>>> ????? current_time = time.strftime("%I:%M")
...

>>> I don't know if that is the correct way as I am just using the code from
>>> the project I am trying to do
>>
>> ????This is showing a severe lack of understanding in how Python itself
>> operates, leading me to recommend rereading a Python tutorial book before
>> attempting to hack into some one else's code.

+1
(in other words, agreement with others who have suggested that your 
knowledge of Python and/or programming, is insufficient to cope with the 
project you've set yourself)


> Err, excuse me, I was not attempting to hack into someone else's code.
> As the code is in the public domain, I wanted it to work as is, like it 
> did for the author, without changing anything.

Please don't be upset. There are multiple understandings of the words 
"hack" and "hacker". Whereas most 'computer people' take the word "hack" 
to mean exactly what you are doing (and "crack" to refer to illegal 
access or ill-intent); the sad state of journalism (and Hollywood) has 
resulted in a confusion of the two.

Within the Python community, the word "hack" is used freely and without 
rancour, and includes both the permitted use of someone else's code, as 
you describe; and improving said code, as per @wlfraed's detailed 
analysis of the code-base's short-comings, a few hours ago.


> So why should I now start to learn how python works.

Only you can answer this: is the effort required to bend the code to 
your will, worth the pleasure or utility the result will bring?

Alternatively, look at how much time *volunteers* have thought 
worth-while investing in helping you! (kudos @Karsten)


There is a safety issue here too. What if the original author had wicked 
intent, and the code actually performs to your disadvantage. How would 
you know? The only way is to inspect the code - reading it for example.


Following-on from the "hacking" comment, if the original author offered 
it to you/the world, and uploaded this code to some public repo(sitory), 
(s)he will also be happy for you/others to correct and improve.

Added to the observation that the code is missing parentheses, it would 
seem that (this version of) the code would never work. Now that you have 
discovered this, the conventions of "open source" are that you will 
propose, or better still, supply a fix...


> If the code doesn't work for me after a fair trial, I'll move on to 
> something else.

Frankly, given @wlfraed's extensive analysis of the code, I'd be 
wondering about its utility too - but again, your assessment is the only 
one that counts.

(If I am confusing two recent list-threads, I apologise)
If you are going to be experimenting with IoT and/or SBCs, the sad 
reality is that it is not an area which has had time to 'collect' a body 
of mature software. Accordingly, lots of the code made 'available' for 
use will be in a fairly rough (or "early") stage. Thus, the greater 
*your* skill-set, the more likely will be success - same as for any 
hobby/work-project! Also, IIRC you are also short-cutting by using a 
Pi-Zero (designed for application and roll-out) rather than a board 
designed for experimentation - but I'm guessing, so again, please don't 
take offense.
-- 
Regards =dn