Sitwon! Thanks for the informative response, it's nice to read answers to these questions!
About classes, I'm still learning the concept of classes, I actually just started the introduction to classes part of my book yesterday. To my understanding they are data structures of functions and used for program organization. I'm still not quite there yet to the point where I can incorporate the concept of classes into my programs (well, not programs, better said random groups of functions!) but I hope to be soon.
Yes, classes are a collection of functions (called members) and data upon which those members operate. It's like you're creating a new data type, but giving it a bunch of semantic meaning and helper functions specific to that data type.
In regards to regex, yes, per your advice I have changed and it is much more versatile than using find() and 10 times more versatile than using line[x:x] == 'searchstring' to match patterns. On the negative side it's not the easiest module to use and takes a little getting used to : ( I've figured out how to make it ID mac addresses but I'm still working on making it identify IP addresses.
You can find a LOT of examples for common patterns like IP addresses, email address, phone numbers, etc. online. Most of the time you can just cut&paste the one you need (although I still recommend learning the language so you understand what the pattern you're using actually does).
Dude, mannny thanks for the fifo pipe advice. I haven't had time to read in depth into this concept but this weekend I am going to and will definitely share my findings. From what I have seen, there are no python programs out there yet that use this technique of parsing output and I hope to be the first!
I'm sure that there must be other python scripts out there that use named pipes, but I think it's probably a less popular technique because it only works on Unix-like systems. Python coders like to write cross-platform code and named pipes aren't portable to Windows systems.
I have a question for you on the ethics of coding Sitwon. My book constantly talks about writing code so it can be easily read and reused by others. I assume it's "ok" for me to use other's code? I mean... some things are a little over my head, but if I copy paste them from another program, I can usually catch on to what it's doing and figure out a way to rewrite it so it looks like I did it and didn't just copy and paste, but from what my book is telling me it's ok to just copy paste code from other open source programs? Coming from a capitalist environment, this concept isn't heavily accepted and I want to make sure it's ok hah : P
Well this can be something of a complicated issue, and there's some subjectivity involved. To simplify it as much as I can, think about it like you would any other language. Imagine you're writing a college paper and your school has a strict policy on academic dishonesty. As a student you're not typically expected to be an expert on the subject matter so it's perfectly acceptable for you to do research and consult the works and opinions of other people with experience in whatever subject matter you're writing about. The same way you would cite those other authors in your paper you should cite the authors of source code that you have substantially copied. Now the subjectivity comes in determining what is a "substantial" copy and what isn't. Some bits of code might be novel and worth attributing to the original author, while others might just be idiomatic patterns of the language which are would be considered obvious to anyone fluent in the language. That judgement will just take experience. If in doubt, cite the author of the code you are borrowing.
In general, these rules apply to all code regardless of what license they are covered by. If your "borrowing" falls within Fair Use then it doesn't matter which license the code was released under. (This has not been heavily tested in court, but it has been upheld in a few notable cases such as SCO v. IBM.) The distinction comes in when you are copying more significant functionality or even the entire program and redistributing it largely intact. In those cases, merely citing the author is not enough, you must also comply with the terms of whatever license is attached to that source code which grants you permission to make copies in cases that fall outside the scope of Fair Use (or not, if it happens to be proprietary code).
The important things to understand are:
A.) Open Source software is not necessarily at odds with Capitalism. The two can and do work together all the time.
B.) Intellectual property laws are complex, convoluted, and subjective (which is why we have lawyers and judges).
C.) The court assumes that as a computer programmer you are equally capable of understanding the legalese in a license agreement as a trained lawyer (Blizzard v. BNet), you can't use the IANAL excuse.
Edited by Sitwon, 28 April 2012 - 10:33 AM.