Python Is Python the Best Language for Electrical Engineering Students?

  • Thread starter Thread starter foges
  • Start date Start date
  • Tags Tags
    Language Python
AI Thread Summary
Python is widely recommended as an excellent first programming language for electrical engineering students due to its versatility and ease of learning. It is suitable for various applications, including web interaction and scientific computing, making it a practical choice for students. While some suggest exploring other languages like C or Java for a deeper understanding of programming concepts, Python's simplicity allows for a smoother entry into coding. Resources such as official tutorials and beginner guides are available to help newcomers get started effectively. Overall, Python is a strong candidate for those looking to combine programming with electrical engineering studies.
  • #51
While I see the utility of Python, I do not like the language. I do not like it at all. (And yes, unlike green eggs and ham, I have tried it.) I find the use of indentation to indicate program structure and the lack declarations to be abominations. Indentation and mistyping identifiers are two of the common mistakes made by programmers. The first computer languages did not require that variables be declared. Later languages added the requirement that things be declared before they are used precisely because of debacles with these early languages. It seems the developers of Python forgot (or never learned) some very important lessons-learned in the development of computer science. "Those who don't know their history are doomed to repeat it."
 
Technology news on Phys.org
  • #53
harborsparrow said:
Warren, I am finding your extreme Python zealotry a little tiring.

Uh, the last time he posted in this thread was more than two and a half years ago.
 
  • #54
D H said:
While I see the utility of Python, I do not like the language. I do not like it at all. (And yes, unlike green eggs and ham, I have tried it.) I find the use of indentation to indicate program structure and the lack declarations to be abominations. Indentation and mistyping identifiers are two of the common mistakes made by programmers. The first computer languages did not require that variables be declared. Later languages added the requirement that things be declared before they are used precisely because of debacles with these early languages. It seems the developers of Python forgot (or never learned) some very important lessons-learned in the development of computer science. "Those who don't know their history are doomed to repeat it."
Pythonistas respond that the mistake is in relying on compiler type checking to catch programming errors. Code must have use test cases alongside, compilers and type declarations are no substitute.
 
  • #55
Riiiight. As if that is how Pythonistas really worked. Very few organizations achieve 100% code coverage, far fewer achieve 100% path coverage.

Even if Pythonistas are the most thorough of all testers, it is a stupid concept. The earlier errors are caught the cheaper it is to repair them. This approach defers error detection until testing, or even worse, post deployment.
 
  • #56
D H said:
Riiiight. As if that is how Pythonistas really worked. Very few organizations achieve 100% code coverage, far fewer achieve 100% path coverage.

Even if Pythonistas are the most thorough of all testers, it is a stupid concept. The earlier errors are caught the cheaper it is to repair them. This approach defers error detection until testing, or even worse, post deployment.
I'm afraid you missed the coding train on this one. The Big New Thing is to write the test code _before_ the code code, and it is common in both Python and Java, and increasingly enforced in large scale projects. I was raised otherwise, but it completely changes the approach to coding. One sets up this entire suite of tests, they all fail initially, and one by one as the code comes up to speed the tests come back Ok. The practice also eliminates the "we'll get to the tests later" procrastination.
http://www.junit.org
http://docs.python.org/library/unittest.html
http://docs.python.org/library/doctest.html
The entire python library is tested in this way.
 
  • #57
D H said:
Even if Pythonistas are the most thorough of all testers, it is a stupid concept. The earlier errors are caught the cheaper it is to repair them. This approach defers error detection until testing, or even worse, post deployment.

D H,you're missing the coding train in more ways than one. One of the most central tenets of Python is duck typing, which means that a given object's current set of methods, fields, etc. determine how it can be used. Objects in Python do not have explicit types; instead, if they express the methods and fields of a some type A, then they can be used as if they were type A. There's no reason to give objects explicit strong types, because most of the objects people write in the real world naturally end up being multi-faceted anyway.

This mechanism is just as strong as actual strong typing, yet provides enormous flexibility. It allows any object to be used in any desired way simply by defining the appropriate methods or fields. You want your data structure to be iterable? Just define a few methods. Any code that attempts to use your data structure in an unintended way will generate a run-time error, which can be caught and handled appropriately.

Strong typing doesn't necessarily make code less bug-prone, and I challenge you to find any studies that claim such a thing. Strong typing is just a poor man's substitute -- an easy to implement, but unduly restrictive substitute -- for real introspection, where one piece of code is actually aware of what another piece of code can do.

That's not to say that strong typing does not have its place. If I were writing code that goes into aircraft avionics, I'd definitely be using a language with strong typing, because it prevents the (extremely rare) possibility of misusing an object that just happens to define methods to make it look like something it is not. In practice, I have never run across such an "impostor" object in years of programming Python, so it's really a non-issue.

- Warren
 
  • #58
D H said:
Even if Pythonistas are the most thorough of all testers, it is a stupid concept. The earlier errors are caught the cheaper it is to repair them. This approach defers error detection until testing, or even worse, post deployment.

Yes, it's such a stupid concept that Google uses it extensively, and we all know how stupid the Googlers are, right? And how terribly awful their software is, right?

- Warren
 
  • #59
harborsparrow said:
Warren, I am finding your extreme Python zealotry a little tiring. I believe that it stifles constructive comparison. Can you please consider that other people here also have a lot of experience? We are interested in your ideas, but not in having them pushed down our throats.

If I were your boss, and I were forcing you to use Python instead of some other language, then I might fairly be accused of pushing Python down your throat.

Instead, I'm just some guy posting on an internet forum. I'm allowed to promote any language I like with the fervor that I believe it deserves. Everyone else here is permitted the same freedom of expression. Get a grip.

- Warren
 
  • #60
chroot said:
That's not to say that strong typing has its place. If I were writing code that goes into aircraft avionics, I'd definitely be using a language with strong typing, because it prevents the (extremely rare) possibility of misusing an object that just happens to define methods to make it look like something it is not.
Well, welcome to my world. Strong typing is just a start. Algorithms must provably run to completion in a fixed amount of space and time. A garbage collector deciding to rear its ugly head would be problematic, but fortunately there is no need to worry about garbage collection in avionics software: Memory allocation is strictly verboten. Python violates many precept of avionics software.
 
  • #61
D H said:
Well, welcome to my world. Strong typing is just a start. Algorithms must provably run to completion in a fixed amount of space and time. A garbage collector deciding to rear its ugly head would be problematic, but fortunately there is no need to worry about garbage collection in avionics software: Memory allocation is strictly verboten. Python violates many precept of avionics software.

I'm well aware of "cleanroom" and other forms of zero-defect software engineering, and I understand the importance of languages like Ada and their strong typing for those purposes.

Despite being labeled a "zealot" in this thread, I understand that different tasks require different tools -- I know a dozen or so languages. The vast majority of programming tasks that most people want to do just don't require the rigor of Ada, though, and and they are better done in languages like Python.

In my opinion, Python just has the best mix of ease-of-use, accessibility, and power of any language available today.

- Warren
 
  • #62
D H said:
Well, welcome to my world. Strong typing is just a start. Algorithms must provably run to completion in a fixed amount of space and time. A garbage collector deciding to rear its ugly head would be problematic, but fortunately there is no need to worry about garbage collection in avionics software: Memory allocation is strictly verboten. Python violates many precept of avionics software.
Real time, safety critical software is also a part of my world including DO-178B. Java lives there too. There are a couple of approaches to bounding garbage collection event times, such as giving it a priority like everything else, or simply declaring some memory objects outside the scope of the garbage collector.
http://www.rtsj.org/specjavadoc/book_index.html
A couple years ago I worked on a team that created an autonomous unmanned vehicle (truck size) where the _entire_ vehicle high level control and navigation system was written in Java. Oh, and I still much prefer Python, whenever I can use it.
 
  • #63
wow guys i want to learn to programme.by fact all the computer science i know is in thory and i can't do shi.tttttttttttttt
 
  • #64
foges said:
Im in my last year of high school and for about two years now I've . I want to be able to use it to make for example: applications that interact with websites, like getting prices off ebay or something.

What is a good language for this.

Well, what you need to do is adapt to many scripting languages.
Hell, I've even scripted for CGI with Forth.

Basically you need to learn some Perl, PHP, Mysql, and basic UNIX so you
can use a shell. I recommend a book; 'Unix in a Nutshell'.

With those tools you can do anything you want but there are many others
too. Basically the only difference between scripting languages is syntax.
The end result is always the same, binary for the processor.

If you choose Unix/Linux for your platform you need to learn a little
about file systems and attributes plus permissions. These are key.

BTW -CGI is Common Gateway Interface. With what you want to do you
will become quite intimate with it.
 
  • #65
I reckon Warren is the man.
Python is the s***
 
  • #66
Python IS good. So are a lot of other languages. But if you ask this question in this forum, it will be a hot topic, because (in my opinion) there are some extreme Python zealots posting in here.
 
  • #68
harborsparrow said:
Python IS good. So are a lot of other languages. But if you ask this question in this forum, it will be a hot topic, because (in my opinion) there are some extreme Python zealots posting in here.

That's quite a serious claim. It might be a good idea for you to identify these "zealots" and the specific reasons why they're guilty of such behaviour. Otherwise, you should apologise.
 

Similar threads

Back
Top