Python 2 to 3 Conversion

Wildman best_lay at yahoo.com
Mon Feb 19 18:01:33 EST 2018


On Tue, 20 Feb 2018 05:39:15 +1100, Chris Angelico wrote:

> On Tue, Feb 20, 2018 at 3:53 AM, Wildman via Python-list
> <python-list at python.org> wrote:
>> On Tue, 20 Feb 2018 02:26:19 +1100, Chris Angelico wrote:
>>
>>> * Opaque IOCTLs
>>
>> Would you mind to elaborate a little about your
>> concerns?
> 
> Look at your original code: it's impossible to figure out what it's
> doing or whether it's doing it correctly. "Opaque" in this context
> means that you can't grok the code without external help. This is a
> code smell, and a strong indication that you're "fiddling" in stuff
> way lower level than you normally want to be working with. It's
> usable, but it's dirty and leaves everything up to you (do you know
> for sure, for instance, if this is backward compatible?
> Cross-platform?), and that makes it comparable to depending on an
> external program.
> 
> ChrisA

I understand and I agree for the most part.  It does concern
me that I don't understand the code.  Anytime in Linux you
start poking around things at kernel level, you need your
eyes to be wide open.  However, to me it looks like the
code is only quarying ioctl and not trying to change any-
thing.  If this is true, there is no problem.

For the issue of backward compatibility, there are good
people on a few of the Linux newsgroups that are willing
to test code snippets for me.  I can get a wide range of
distros, desktops and kernel versions.  And of course
different python3 versions.  I know it is impossible
to write code that will be guaranteed to run on all
conditions.  But the test results I get will or should
let me know right off if there are glaring problems.

As far as cross-platform goes, that is not an issue.
Every thing I do is targeted for the Linux platform.

I will keep "ip" in mind as a backup plan.  As a novice
Python programmer, I am looking at the amount of code
it will take to parse ip's output compared to the few
lines of code it takes to call ioctl.

I really appreciate your insight.  Thank you.

-- 
<Wildman> GNU/Linux user #557453
"There are only 10 types of people in the world...
those who understand Binary... and those who don't."
  -Spike



More information about the Python-list mailing list