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.
foges
Messages
52
Reaction score
0
Im in my last year of high school and for about two years now I've wanted to learn to program, but i havnt really gotten into it.

Basically I am going to study electrical engineering in a bit over a year (military service comes first) and I would like to learn a language that is useful for that purpose.

I don't want it to be limited to programing robots or circuits though. 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. I've heared that Python is a good all around language. Then again I've heared others recommend delphi because apparently its more hardware interactive than other languages. What do you guys think?
 
Technology news on Phys.org
Python is an excellent general-purpose programming language, and it even does a very good job of some specialized tasks like scientific computing.

If this is your first programming language, Python is an excellent choice. You will be essentially forced to learn C at some point in your career though, simply because it is so ubiquitous.

- Warren
 
thanx a lot. Can you recommend any book? or should i start out with the tutorials on the python website, then byte of python, then dive into python?
 
Start with a hello world tutorial like this: http://www.penzilla.net/tutorials/python/intro/ and build your way up.

Once you are fairly comfortable with python try some other languages out and get a feel for them and why they are different etc... you might not want to stick to python, I know a lot of people dislike its special treatment of white-space, and other non-standard programming language features. At the same time though others don't care.
 
Last edited by a moderator:
foges said:
thanx a lot. Can you recommend any book? or should i start out with the tutorials on the python website, then byte of python, then dive into python?

Check out the official Python website:
http://www.python.org/about/gettingstarted/

Also, beginner's guides at:
http://wiki.python.org/moin/BeginnersGuide/Programmers

Python was designed as a language to teach programming. It is wonderfully consistent. It has very little "it works like this except on Tuesday" for such a powerful language. C++ is a nghtmare in this regard.

Since you mention it, there is a site called "Dive into Python", but it's really for more experienced programmers http://diveintopython.org/
 
Last edited by a moderator:
As far as I know, Java is the most widly spread and popular language in the world having more active developers than any other language (and jobs aswell)

http://www.tiobe.com/tpci.htm

it is also the language of choice for teaching programming at numerous universities across the globe.

I have had 2 programming lessons at my university both of them consisted of Java and the second one of C aswell.

If I got to learn programming by myself, I would start with C, just to get the basic of procedural programming (loops, if statements,etc) compilation and then when it would be time for pointers I would switch to Java and learn OOP(Object Oriented Pradigm - the most popular paradigm and IMHO the most useful).
 
Jheriko said:
Start with a hello world tutorial like this: http://www.penzilla.net/tutorials/python/intro/ and build your way up.

Once you are fairly comfortable with python try some other languages out and get a feel for them and why they are different etc... you might not want to stick to python, I know a lot of people dislike its special treatment of white-space, and other non-standard programming language features. At the same time though others don't care.

Thanx, I am trying those tutorials, I am on the second page though and my IDLE isn't giving me the response it should:

Code:
>>> inta = 100
>>> fact = def factorial (n):
	
SyntaxError: invalid syntax
PS: the the orange def is supposed to be highlighted not coloured

Im prety sure I am typing everything that's on the website in the yellow box:

http://www.penzilla.net/tutorials/python/datatypes/
 
Last edited by a moderator:
foges,

That tutorial is bad! It definitely contains code that will not run in modern Python interpreters.

You can change the code to this:

Code:
inta = 100
def factorial (n):
    if n == 0:
        return 1
    else:
        return n * factorial(n-1)

fact = factorial
intb = fact(100) # 100! is pretty damned big, notice python doesn't choke.

There's no real reason at all to use the 'fact' identifier to mean the factorial function, though. Why not just do it this way?

Code:
inta = 100
def factorial (n):
    if n == 0:
        return 1
    else:
        return n * factorial(n-1)

intb = factorial (100) # 100! is pretty damned big, notice python doesn't choke.

- Warren
 
haki said:
As far as I know, Java is the most widly spread and popular language in the world having more active developers than any other language (and jobs aswell)

I can guarantee you that this will not be true indefinitely. Java has already crested its peak popularity, and will eventually decline into obscurity (where it belongs).

- Warren
 
  • #10
chroot said:
I can guarantee you that this will not be true indefinitely. Java has already crested its peak popularity, and will eventually decline into obscurity (where it belongs).

- Warren

I am curious as to why you have made this comment. Can you be more specific?
 
  • #11
Ronnin said:
I am curious as to why you have made this comment. Can you be more specific?

From the same data source given by haki:

http://www.tiobe.com/tpci.htm

You can see for yourself the trend that Java's popularity is declining. This is important to me, because Java is, in my opinion, a bloated, extremely verbose, unnecessarily rigid and syntactically painful language. The only advantage it has is that it has a very large standard library, though the libraries available for other languages like Python are really almost as complete.

- Warren
 
  • #12
I myself have never used Python. I'm sure I'm going to draw ire of many stating my preference is C# at this time. I have used Java (JSP & Beans) to some extent but have had little exposure to their Server Faces. I was just curious as to whether Python had the same control extensability as Java and C#. I'm not nearly the purist I use to be and find myself doing more customizing than building core web logic (state management for example) as I use to. I am interested in your take because as you have stated the buzz around Java has for the most part has faded.
 
  • #13
I don't exactly know what you mean by "control extensibility," but I have never found anything that I can do in Java or its cousin C# (or even distant languages like Perl and shell scripts!) that I could not do more easily in Python. Your mileage may vary, but I believe Python is the coolest language on the planet at the moment. Sure, some people think it's a bit weird that the tab character is a meaningful component of the language's syntax, but, once you get over the bias and begin using the language, you quickly realize just how nice it is after all.

- Warren
 
  • #14
I'm no cheerleader for any language. I am curious to how Python works when implimenting web logic such as state maintainance. How hard is it to do a simple select from a DB and render a table or XML to the browser. I'm looking at it from a standpoint of how hard is it to port existing code from another language to Python.
 
  • #15
I'm sure it's as competent as any other language. It has DB modules, CGI modules, and XML modules included in the default install. I'm not a web programmer, though, so I can't give you specific examples. Google "python cgi" for all the examples you could ever want.

- Warren
 
  • #16
I believe I have hijacked this thread long enough. Chroot, I appreciate you take. I have played around with Linux as a web platform and have used Apache w/ Tomcat for JSP and servelets. I knew you had done some work on this forum so I was just curious as to your opinion. Thanks for your replies.
 
  • #17
chroot said:
From the same data source given by haki:

http://www.tiobe.com/tpci.htm

You can see for yourself the trend that Java's popularity is declining. This is important to me, because Java is, in my opinion, a bloated, extremely verbose, unnecessarily rigid and syntactically painful language. The only advantage it has is that it has a very large standard library, though the libraries available for other languages like Python are really almost as complete.

- Warren

That is ofcorse your opinion in mine you shouldn't have commented on something you do not understand. I haven't programmed in Python soo I will not comment on it, if you haven't done any serious work in Java please do the same.
 
  • #18
chroot said:
but I have never found anything that I can do in Java or its cousin C# (or even distant languages like Perl and shell scripts!)

If you put your mind to it, or choose a sufficiently difficult problem with sufficiently stringent constraints you are essentially forced to use C++ or assembler or to invent a similarly tight language. For instance a while ago myself and a small group of devs I was working with were looking for a scripting language to incorporate into a interactive 3d renderer. Python was not sufficient (at that time anyway, I understand that there are now quite a few compilers which generate code in memory from Python, where as at the time all we could find was the slow and clunky interpreter), although in its favour no major script on the market was sufficient for our needs either, also Python was far and away the best script we toyed with.
 
Last edited:
  • #19
haki said:
That is ofcorse your opinion in mine you shouldn't have commented on something you do not understand. I haven't programmed in Python soo I will not comment on it, if you haven't done any serious work in Java please do the same.

Well, let's see here, haki...

I began programming in Java in 1996, and taught classes on the language to high-school seniors in 1997. I have written literally dozens of major applications in the language, including this one that I wrote for National Semiconductor in 2002. This program included some 200 classes, for a total of some 50,000 lines of Java. It did everything from communicating with hardware via USB, to mathematical analyses on data, to image processing -- and, of course, had a quite nice user interface.

Here's a screenshot of it:

http://www.virtualcivilization.org/WaveVision-LowRes.jpg

It's still available from National Semiconductor:

http://www.national.com/appinfo/adc/wv4.html

I know Python literally as well as I know Java. I have written enterprise-wide applications that allow our design engineers to analyze analog waveforms from simulations, store them in databases, and perform regression analyses with a number of different waveform viewers. If you don't believe me, I'd be happy to take some screenshots of it.

Now, what was that you said about me commenting about something that I "don't understand?"

- Warren
 
Last edited by a moderator:
  • #20
ooooo ... pwnt.
 
  • #21
To a high school student who plans to study Electrical Engineering, I would recommend starting with the Mathematica programming language.
 
  • #22
Crosson said:
To a high school student who plans to study Electrical Engineering, I would recommend starting with the Mathematica programming language.

Mathematica is not strictly a programming language, its more of a highly specialised script. You don't need to understand too many programming concepts to use it, so I'm not sure how good it would be for learning programming in general...
 
  • #23
As I recall from the Java Whitepaper[1], Java as a language was designed to be simple (very little syntactic suggars) and Robust (rigid and verbose) and a few more things. What you wrote as shortcomings are actually the design goals of Java.

But, I admit that pre Java 5.0 it wasn't that nice to program in Java as is now.

[1] http://java.sun.com/docs/white/langenv/
 
  • #24
The problem with learning a first programming language is you need to learn at least 5 things at once: The specifics of that language, software design principles, (object orientation/modularity/information hiding/whatever is the fashionable buzzword this week), some basic algorithms, GUI design, and debugging techniques.

For the second language it gets easier, since you only have to relearn the first one.

In the long run I don't think it matters much what language you start with. I got paid to write my first program in about 1970, and I reckon I've learned a new language every 2 or 3 years since then. The only language I've used that has survived the whole time period was Fortran (and even then, Fortran 90 doesn't look much like good old Fortran II).
 
  • #25
haki said:
As I recall from the Java Whitepaper[1], Java as a language was designed to be simple (very little syntactic suggars) and Robust (rigid and verbose) and a few more things. What you wrote as shortcomings are actually the design goals of Java.

Regardless of whether its lousiness was a design goal or not, it's still lousy.

- Warren
 
  • #26
As long as Sun are behind Java it won't go away.

I aggree as an enduser it can be very slow, but it seems very flexible in that it is independent of the 'enviroment' it sits on..
 
  • #27
Python is even more flexible than Java in terms of inter-platform compatibility, because it not only runs anywhere, it can also operate with a wide variety of windowing toolkits.

Sun itself may well go away one day (this is also looking quite likely), and Java will hopefully follow it to the grave.

- Warren
 
  • #28
I hope not, as I like Solaris, but its getting opened up anyway...
 
  • #29
I have just never been able to get inot python, I love Java, and would recommend it to anyone, especially as a first language, however, I would be grateful if someone could give me a good python tutorial (book or website) that is, how should I say this, not boring? or rather is indepth and has a lot of applications besides the standard "Hello world!" I guess I just need to get past the first few chapters in python to begin to like it more
 
  • #30
Yeah, there is no need to wish Sun to bancrupt and saying that Gosling envsioned a lousy language.

Sun is shining for Sun, sales are growing, markets expanding, Java will be here for quite some more time.
 
  • #31
mgiddy911 said:
would recommend it to anyone, especially as a first language, however, I would be grateful if someone could give me a good python tutorial (book or website) that is, how should I say this, not boring?

Check out www.byteofpython.info, its for beginners. I am reading my way through it, so i don't know if its a great book, but it seems good enough.
 
  • #32
Sun is not doing so well, actually. They opened today at 6.14, which is the lowest of related companies. Their height was 64.3125 back in 2000, right in the middle of the Java boom. While they did increase revenue by 2 billion in 2006, their net income went from -107 million in 2005 to -864 million in 2006. Back in 2003 they lost 3 billion. Even though an increase in revenue is arguably a good thing, Sun has certainly not been in a strong position for a long time.
 
  • #33
Ermm.. 'share price' isn't a good indicator of how well ca company is doing relitave to other comapnys in a sector. Its better to look at Revenue, and Market capitalisation.

Anyway Sun won't go away, its a IT giant, I can't see them going bankrupt unless something eronish happens to them
 
  • #34
Anttech said:
Ermm.. 'share price' isn't a good indicator of how well ca company is doing relitave to other comapnys in a sector. Its better to look at Revenue, and Market capitalisation.

Anyway Sun won't go away, its a IT giant, I can't see them going bankrupt unless something eronish happens to them

You are right, it's not the the greatest indicator for outright comparison. However, Sun is also the lowest of the ten or eleven other top companies competing in the sector if you do a more indepth analysis--Microsoft being number one. Revenue is rather meaningless if you continue to lose money. Share price isn't a good indicator by itself, but combined with losses it is relevant.

Sun does look like they could turn around, but it is doubtful if they continue their pattern of losses.
 
  • #35
chroot said:
Python is even more flexible than Java in terms of inter-platform compatibility, because it not only runs anywhere...

I don't understand this, they both work using the same underlying princple of intepreting virtual instructions at run time... how can one be more flexible than the other?

Perhaps Python has been implemented on some major platform that Java has not and I am just not aware of it...
 
  • #36
eieio said:
You are right, it's not the the greatest indicator for outright comparison. However, Sun is also the lowest of the ten or eleven other top companies competing in the sector if you do a more indepth analysis--Microsoft being number one. Revenue is rather meaningless if you continue to lose money. Share price isn't a good indicator by itself, but combined with losses it is relevant.

Sun does look like they could turn around, but it is doubtful if they continue their pattern of losses.
Yeap.. can't disagree with that. Sun arent as good as they once were, but they are still a huge company with some VERY good products.

Anttechs would put Sun as *Sell* right now :) But not forever.. I think they are a good enough outfit to come back, with a strong *geek* techncial appreciation, perhaps not from this board but elsewhere for sure, they will be bale to make inroads back into the Server, and application market..
 
  • #37
Java isn't open sourced, Python is.. I have a sneaky feeling this is a cloaked props to the GNU community :wink:
 
  • #38
Anttech said:
Java isn't open sourced, Python is.. I have a sneaky feeling this is a cloaked props to the GNU community :wink:

However, key Java implementations such as SE, ME and EE are open source.
 
  • #39
SE, ME, EE are what exactly?

Im a network engineer not a programmer.
 
  • #40
SE is the Java version (libraries and virtual machine) that you can use to run desktop programs on your PC.

ME is the Java version that runs on your mobile device (specialied libraries and virtual machine)

EE is the Java version that works on Servers (or on your desktop) (imagine as an upgrade to the SE version) it provides libraries and services for web based solutions.

There is nothing sneeky about Java, all what you are required is to acknowledge that Sun is the author of Java how you use Java technology is your own thing. But if that is to much to ask...then there are other alternatives or you can always write your own language.
 
  • #41
I don't mean to derail the thread, but I have to disagree with Anttech's comment about share prices.

Most investors feel that the share price essentially "encapsulates" every piece of available knowledge about a company, and thus that the share price is the most meaningful indicator of a company's health. Investors essentially vote with their money, and the bears and the bulls (with various amounts of knowledge about the company) fight until a consensus is reached in the share price. Many investors believe that everything known about a company is "baked into" the share price.

- Warren
 
  • #42
mgiddy911 said:
I have just never been able to get inot python, I love Java, and would recommend it to anyone, especially as a first language, however, I would be grateful if someone could give me a good python tutorial (book or website) that is, how should I say this, not boring? or rather is indepth and has a lot of applications besides the standard "Hello world!" I guess I just need to get past the first few chapters in python to begin to like it more

Python's actually a CS geek's wet dream -- it's full of interesting and important and exciting features that are totally absent in many other languages. Look up "list comprehensions," and let me know if you don't find them un-boring.

If you tell us what resources you used to learn Java, I'm sure we could find some similarly un-boring resources you can use to learn Python.

- Warren
 
Last edited:
  • #43
chroot said:
I don't mean to derail the thread, but I have to disagree with Anttech's comment about share prices.

Most investors feel that the share price essentially "encapsulates" every piece of available knowledge about a company, and thus that the share price is the most meaningful indicator of a company's health. Investors essentially vote with their money, and the bears and the bulls (with various amounts of knowledge about the company) fight until a consensus is reached in the share price. Many investors believe that everything known about a company is "baked into" the share price.

- Warren

Your assuming a perfectly efficient market system. Market is price is more a popularity contest than a real indicator of underlying value. There are countless fine companies with lame stock prices. Also remember that institutional trading has a lot to do with stock prices as well. It's far from a perfectly valued market.
 
  • #44
Ronnin said:
Your assuming a perfectly efficient market system. Market is price is more a popularity contest than a real indicator of underlying value. There are countless fine companies with lame stock prices. Also remember that institutional trading has a lot to do with stock prices as well. It's far from a perfectly valued market.

I'm well aware of the efficient market hypothesis. The truth is that, for large, well-known companies like Sun, the market is essentially perfectly efficient.

- Warren
 
  • #45
chroot said:
I'm well aware of the efficient market hypothesis. The truth is that, for large, well-known companies like Sun, the market is essentially perfectly efficient.

- Warren

Well we've gone off topic of the thread here but all I can say is that investor sentiment can turn on a dime. Companies fall in and out of favor with investors but yet the companies have esentially stayed the same. Speculation for things that may or may not happen is also "baked-in" to a stock's price as well. I guess every investor takes that risk on how "efficient" they think their stock's price is.
 
  • #46
Since this is already way off topic...

I think with Sun we could make a lot of arguements of how their stock price has been affected by things that would indicate a not so great position for the company thus making the initial point.

Sun is not in a strong position in the market, and really haven't been.

Stock price peaked in 2000. Notice what else did?

Net Income:
2000 $1.8b
2001 $927m
2002 $(587)m
2003 $(3.4)b
2004 $(388)m
2005 $(107)m
2006 $(864)m

While I'm not attempting to say that net income or stock price says it all or even a majority of it, we can see a clear correlation between the company being profitable and their stock price...so yes, stock price is an indication of something...

In all reality, even popularity has meaning. A non-popular company is not as likely to be as profitable. Point is: stock price *can* indicate the strength of a company. In the case of Sun, I think it does. Even if we call it all a popularity contest.
 
  • #47
Let's throw some data on the fire: According to the Wall Street Journal, Sun's five year Price Performance versus Industry (Dow Jones Computer Hardware) is around -53.90%. There is a weak uptrend in this starting late calendar 2005, but not as strong as the sector or the overall market. For comparison, Dell's performance over the same period presently stands at -7.14%; Hewlett Packard is +83.36%, and Apple is +810.21%. Sun is about exactly halfway down the chart in this category.

Sun certainly projects a certain gloom, as if it's got one foot in the land of the long lost RISC dino-vendors. Java probably is not enough to keep them afloat.

In principle, share price is the sum of all future earnings discounted to the present. The principle fails because 1) you can't know the future earnings, 2) you don't know how interest rates will vary in the future. But analysts do try: stock prices are not purely arbitrary popularity contests.
 
  • #48
Most investors feel that the share price essentially "encapsulates" every piece of available knowledge about a company, and thus that the share price is the most meaningful indicator of a company's health.
I don't dissaggre, but it isn't a good way to compare companys

IE Cisco's share price maybe 20$/share and RBS maybe 2$/share, but RBS could still be a more healthy and profitable company but its capitisation is different than that of Cisco.. This is what I was meaning
 
  • #49
chroot said:
Sun itself may well go away one day (this is also looking quite likely), and Java will hopefully follow it to the grave.

I'm really quite surprised by the volume of people that still think (1) Sun is dying and (2) Sun is still exclusively a RISC vendor, first and foremost; however, nothing would really be further from the truth. Sun has become a very serious AMD64 vendor, and in my opinion, one of the better ones, if not the best. Their AMD64 servers have massive density, processor, IO, and memory-wise.

Do you see Dell, IBM,. etc putting out anything like this?

http://www.sun.com/servers/x64/x4500/
http://www.sun.com/servers/blades/8000/

And likewise, while Sun is nowadays an AMD64 vendor, they still haven't forgotten about SPARC. The road for SPARC development seems to be massively threaded systems and processors, like the T1000 or T2000, with an UltraSPARC-T1 that supports up to 32 simultaneous threads:

http://www.sun.com/servers/coolthreads/t2000/

Keep in mind, the T2000 will outperform most of the SPARC mid-range and AMD64 servers on certain workloads, namely those that aren't floating-point intensive and are highly parallel. This seems ideal for database and web serving workloads, and the benchmarks indicate this, as well.

Lastly, Solaris 10, which was released 2 years ago has features that Linux is trying to implement (and failing horribly) and features that Linux won't be able to implement if ever because of inherent design flaws. Systemtap (which is the equivalent of Solaris' DTrace) is at the mercy of Linux kernel API compatibility, which if anyone has ever written a driver in Linux -- it amounts to searching through headers, finding an interface, and praying that interface won't be deprecated in the near to remote future. Volume mangement sucks on Linux, pure and simple, whereas ZFS has completely re-written the book on storage and filesystems. (Take a look at http://opensolaris.org/os/community/os_user_groups/os-presentations/zfs.pdf if you don't believe me)

So, before you say Sun is dead or dying, take a look around at the market. You'll find a number of technologies that Sun is sharing with the rest of the community that no one else has, and plenty of people are interested in them. There have been large Solaris 10 deployments on Wall Street and FedEx is very interested in Solaris 10, as well. In fact, FedEx has used DTrace to analyze a number of their in-house applications, which led to improved performance.
 
  • #50
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.
 

Similar threads

Back
Top