I heard that Python is easy and powerful, but I don't know if I'm on the right track to learn it. I learn from online tutorials, I know basic maths calculation and printing strings, but how long will it take to develop something useful? I don't really know the exact uses of Python, though.
I'm not exactly sure what you're looking for, but I think one or more of the following may be the next step you're looking for.
Perhaps you would like to use a variety of different protocols for a networking program, you could check out Twisted.
Or perhaps if you would like to make a web application or blog you can check out Django.
Or perhaps you would like to make a GUI application, you could take a look at TkInter.
Or perhaps you would like to get into game programming, you could take a look at Pygame.
Or perhaps you would like to ... you can take a look at the Python Package Index.
How long will it take? This depends on your programming background in general. The best way is simply to jump into the topic you're interested in and start on a mini project.
Python is a general purpose language. You can use it to make a lot of different things, but it's best suited at stuff that doesn't require a lot of speed, since the high level features have a performance cost.
It's hard to tell how long it will take you to develop something useful. The other day I made a script to help on a small computer administration thing. You could do that with a week or two of experience (or maybe less), depending on your previous programming knowledge and the amount of time you put into studying. However, if you want to make something bigger (maybe an audio player, an IM client, mid-sized stuff like that), you probably need some weeks or months of practice. It depends a lot on the time and energy you invest in programming.
I'd suggest to follow either the official tutorial or Dive Into Python.
In general, it depends on you. Python can be used for simple or complex stuff, and for many different applications. It depends on what you want.
Have a look at Mark Pilgrim's freely available book called Dive Into Python. I think it's a better choice to start with than online tutorials. The best way to learn a language is to start to work on a project. As I read this book, I started to implement a simple image viewer. As I advanced with the book, I could refine the project progressively. Invent something that is interesting to you.
I also suggest you taking notes when you learn a programming language. When you learn something that can be useful later, make some notes with a simple example, e.g. how to read a text file line by line, convert int to str, convert str to int, basic list operations, etc. Later on you can use these building blocks in a larger project.
Like every other programming language In order to learn Python you need to write a program with it.
Find a pet project and use python to code it. I also recommend Dive into python" (like anyone else that answered your question).
A few months ago I've decided to learn IronPython (.NET implementation of python), I'vve started by reading "Dive into python" and a few tutorials and then I've started coding a simple board game using IronPython (you can read about it in my blog).
In order to learn a new programming language you need to use it and then you'll know how and where to use it.
The best way to learn how to do something useful is come up with something useful you want to do. Make sure it's not way out of your league, then do research to accomplish it. That's how a lot of programmers learn languages.
What other programming background do you have? What programming interests do you have -- web apps, numerical / scientific computations, games, ...? Python is good at many different things, for both beginners and experienced programmers, but the most fruitful approach(es) to it do depend on what you already know, and what really interests you!-)
Bram who invented bittorrent with python says python is good for writing protocols in addition to aforementioned webapps, games and general purpose. Compared to Java python solves same problem in less code and less ways in longer development and VM time where Java has more ways solve same problem in more code and faster VM and faster development time.
Making a comparison between Python, and other languages would not help, as there is always somebody who would find a reason to prefer one language instead of another.
If you want a scripting language that is powerful, but that it is easier to read than perl, that doesn't have a curly bracket syntax, and that allows you to learn something about object oriented programming, then Python is the language for you.
Related
I'm a hobbyist programmer (only in TI-Basic before now), and after much, much, much debating with myself, I've decided to learn Python. I don't have a ton of free time to teach myself a hundred languages and all programming I do will be for personal use or for distributing to people who need them, so I decided that I needed one good, strong language to be good at. My questions:
Is python powerful enough to handle most things that a typical programmer might do in his off-time? I have in mind things like complex stat generators based on user input for tabletop games, making small games, automate install processes, and build interactive websites, but probably a hundred things along those lines
Does python handle networking tasks fairly well?
Can python source be obfuscated, or is it going to be open-source by nature? The reason I ask this is because if I make something cool and distribute it, I don't want some idiot script kiddie to edit his own name in and say he wrote it
And how popular is python, compared to other languages. Ideally, my language would be good and useful with help found online without extreme difficulty, but not so common that every idiot with computer knows python. I like the idea of knowing a slightly obscure language.
Thanks a ton for any help you can provide.
Is python powerful enough to handle
most things?
Yes. Period. Study EveOnline game for more information. Look at pygame framework. Free free to use Google to find more.
Does python handle networking tasks
fairly well?
Yes. Look at the number of Python web frameworks plus the Twisted framework. Feel free to use Google to search for Python networking.
Can python source be obfuscated?
Not usefully. This isn't C.
And how popular is python, compared to
other languages?
Look at the TIOBE index.
I think that Python is very powerful to do a lot of things, but just like Java and C++, it often depends on good third-party libraries. I come from a Java background but use Python for a lot of things, and it's been a fun ride. I've done things like statistics, and automation, not sure about the UI though that often depends on the toolkit more than the language.
Python networking works well. I don't know if I'd use it to build a fast algorithmic trading system or a VOIP application, but for most intents and purposes, especially at higher levels of abstraction, it's fine and easy to use. You would need external libraries for things like SSH or FTP.
Python is quite popular and has very good online support, active community, and major corporations (likeGoogle) that use it. I found the official online tutorial and reference to be excellent.
I have to say that I disagree with the "every idiot with a computer" line. There's a difference between knowing a language and using it right, and that's true about every language, even natural ones :) Python does have a lot of functional elements that are not as trivial to use for people coming from a procedural background, so there's always room for growth.
The one problem with Python compared to languages like C and Java is that it is not statically typed. This makes it much faster to write code, but also makes it *much easier) to make mistakes that can be quite nasty to debug. For instance, the same variable can contain a String reference at some point, and a reference to a list of strings at some other point.
Absolutely.
What type of networking? It has socket, http, xml, smtp/pop, telnet, and much more built in.
Python obfuscation won't be nearly as good as a compiled language. Usually that isn't a problem.
It's the 9th most popular tag on stackoverflow, so there's plenty of help available.
Is python powerful enough to handle most things that a typical programmer might do in his off-time? I have in mind things like complex stat generators based on user input for tabletop games, making small games, automate install processes, and build interactive websites, but probably a hundred things along those lines
Definitely. Python is a good tool for all of those except automating install processes, where it might be the right tool but more likely the right tool will likely be decided by what specifically you are automating.
Does python handle networking tasks fairly well?
Yes. You will want to look into Twisted.
Can python source be obfuscated, or is it going to be open-source by nature? The reason I ask this is because if I make something cool and distribute it, I don't want some idiot script kiddie to edit his own name in and say he wrote it
"Open source" refers to the licensing of your code, not the viewability of its source code. Hiding Python source code isn't especially possible, and the results of decompiling Python bytecode will result in much more readable code than the equivalent tools in languages like C. Don't worry about this! You can't prevent people from stealing your car or your computer if they are willing to break the law, and you can't do the same for your code in any language.
And how popular is python, compared to other languages. Ideally, my language would be good and useful with help found online without extreme difficulty, but not so common that every idiot with computer knows python. I like the idea of knowing a slightly obscure language.
This is an unanswerable question. Google will give you lots of conflicting results with different metrics, most of them useful. You're also being a bit silly ;)
As far as learning materials go, I recommend How to Think Like a Computer Scientist, which is a good text that does not presume any existing programming knowledge. It is available for free online, or you could buy a print copy if you prefer. (Don't bother learning 3.x yet. There is not enough library support to do much useful stuff like you want to do, and when there is picking it up will be a breeze; it's not very different than 2.5/6/7.)
Probably yes. Maybe the stat crunching thing will be kinda slow, and maybe a game depending on what kind of game, but generally the performance is good enough, and you save a lot of time on the actual programming. If you REALLY need performance, you can make a module in C, but usually there is a library written to do what you want..
I haven't used it, but there's a framework called Twisted that seems to be pretty good.
No. Bytecode can be decompiled easily, and it only works on a specific version of Python, so your code isn't as portable.
Python is pretty popular, and the Python Package Index has a big list of third party libraries. It's not as widespread as, say, Java, but a lot of people use it and you can probably get answers for what you want.
Points 1 and 2: HELL YEAH.
Point 4: kind of. Python is good at some network stuff. It's not Java or C++. Just use zlib (zip library) and pickle (serialization) for everything, and look at xmlrpclib if you need IPC.
Point 3: No. However, you can write C modules (for the performance critical, and hard-to-copy) parts of your code, and that would make it non-trivial to reverse-engineer.
Python is up to the task (and better) for 1, 2 and 4.
The best solution for 3 from what you describe would probably be to make your programs really open-source with GPL or BSD like licence. This way people will edit your super-cool sources (but often experienced programmers, not just script kiddies) and build on then but leave your name in for posterity.
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
I'm a newbie to programming. I had 1 semester of computer science (we used java). I got an A in the course and was able to do everything assigned, however I'm not sure I really understood it. I ignored the text and learned by looking at sample programs and then trial and error. I was ahead of the class except for two guys who came in knowing java or another OOP language.
I'd like to learn Python. I'm also going to build a second PC from extra parts I have and use linux. Basically, I want to enhance my knowledge of computers. Thats my motivation.
Now on learning python are there any good programming theory books that would be useful? Or should I read up on more on how computers operate on the lowest levels? I don't think I know enough to ask the question I want.
I guess to make it simple, I am asking what should I know to make the most of learning python. This is not for a career. This is from a desire to know. I am no longer a computer science major (it also would not have any direct applications to my anticipated career.)
I'm not looking to learn in "30 days" or "1 week" or whatever. So, starting from a very basic level is fine with me.
Thanks in advance. I did a search and didn't quite find what I was looking for.
UPDATE: Thanks for all the great advice. I found this site at work and couldn't find it on my home computer, so I am just getting to read now.
My recommendation is always to start at the high level of abstraction. You don't need to know how logic gates work and how you can use them to build a CPU -- it's cool stuff, but it's cool stuff that makes a lot more sense once you've messed around at the higher levels. Python is therefore an excellent choice as a learning aid.
How to Think Like A Computer Scientist: Learning With Python is available on the Internet and is an excellent introduction to the high-level concepts that make computers go. And it's even Python-specific.
If you're looking to have your brain turned inside-out, SICP will do a good job of it. I don't recommend it as a first text, though; it's heavy going.
Both of these books are high-level. They won't teach you anything about the low-level details like memory structures or what a CPU actually does, but that's something I would reserve for later anyway.
D'A
Specifically for the Python part of your question I can highly recommend http://www.diveintopython3.net/ by Mark Pilgrim. That's free and pretty well structured.
Python is a nice choice, you will have fun!
http://www.pythonchallenge.com/
I think this Challenge is perfect to get in touch with major python strengths and there is a nice forum with a lot of interessting Python Threads for each Level.
A lot of this depends on what your overall goal is for learning Python. Are you viewing it as learning a second language or getting a better understanding of computers and how to effectively use a programming language?
From what it sounds like you want to gain a better understanding about computers and be a better programmer. Learning a new languages such as Python will probably not help you in this respect. I still recommend learning Python if you're interested, but once you have learned one programming language, much of learning a new language is getting familiar with the syntax and data types (usually).
You had mentioned you were unsure about understanding the material in the class you took. If you feel you don't understand fundamental concepts (such as loops, classes, etc), then learning Python will help your understanding of programming as most books/guides revisit these concepts (Learning Python, 3rd Edition should help with this). If you understand these concepts, but you are unsure of how to apply these concepts, then my recommendation would be to learn about data structures and common algorithms (e.g. sorting, searching, etc).
Speaking from personal experience, I didn't know how to apply what I learned from the introductory programming class to personal programming projects. Learning about data structures from a class helped solidify those concepts I had previously learned by providing algorithms/data structures that build off of this previous knowledge. This class also allowed me to think differently about problems in terms of using these data structures.
To learn about the different types of data structures, see: http://en.wikipedia.org/wiki/List_of_data_structures. Usually, each data structure is useful for a specific purpose (e.g. binary search trees are good for searching sorted information). Unfortunately, I don't have any book recommendations (our class didn't use a book). Googling "Data Structures" should be a good starting point.
Data structures also got me to think about how efficient an implementation is. The "complexity" of an algorithm determines how long a given piece of code takes to run. This makes it easy to compare other implementations and determine which is better.
I would also like to comment that when it comes to learning computer concepts, the best way to learn is by doing. A book/class can only explain so much, and the rest you have to learn on your own. Each person learns differently, and programming is a way of taking the material you read about and think about it in a way that is best understood by you.
I hope I answered your question. At this point, you don't really need to worry about the underlying hardware. This is useful to know if you plan on doing this as a career (which you aren't), or want to make optimizations specific to the hardware you're running on (in which case, you wouldn't want to use Python). Python is a good choice to learn about data structures as it implements a lot of them for you, but it's important to know what they are used for.
If you are still in school, take a data structures class and see what you think of it. If you like it, I'd advise reconsidering the role of programming/CS in your career. You don't have to major in it, but consider a minor or at least a position that makes use of these skills you are learning. I say this because despite this not being your major, you are interested in understanding how a computer works and taking initiatives such as learning Python, building your own computer, and installing Linux.
If you have any further questions, feel free to ask. Good luck!
Python is a high-level language, so it wouldn't give you much direct benefit to learn how computers operate at the lowest levels.
Don't get me wrong - I do strongly believe that the low-level operation of a computer, e.g. assembly language and hardware, is something that every good programmer should be familiar with, because it does help you program more effectively in whatever language you are using, high-level or low-level. But it won't make much of a difference in your Python coding until you've gotten quite a bit of experience. If you're just starting out with Python, I would suggest staying away from the low-level operation of computers and concentrating on the basics of Python for now. Once you're comfortable with that, you can move on to something like C and then it might be appropriate to start looking at some lower-level stuff.
As for what you should know... not much, I guess. Python is a great language to start out programming in. It keeps simple things simple but it's rich enough to let you work your way up to a high level of complexity. I'd suggest probably looking at a tutorial; the one I happen to know is on the Python website, but I'm not claiming it's necessarily the best one for you. A Google search should give you plenty to get started with.
I started Python (as my first programming language) few months ago. I would recommend Learning Python, by Mark Lutz to begin with. But keep in mind that the key to learn well is to be open-minded, patient and willing to work and look up for things you don't understand.
Have fun!
I would suggest looking at the online book at http://www.diveintopython.org/ to learn python.
As for python projects, I would try learning the Django Framework. It is a framework for building web applications. They have a great tutorial for getting started with it. This would also give you experience building a webserver on a Linux box.
enhance my knowledge of computers
Well, what do you exactly mean by that? Python, or any other high level language, are designed to actually hide all the nasty details. That's one of the reasons, why it's apt for non-pros like (e.g. scientist).
If you want to know how stuff actually work, you should learn pure C. But then again, if you're not planning to have any career related to SC, there's not much point to it. Learn some more advanced algorithms and data structures instead. That'll result you more interesting, useful and is platform- and language-agnostic.
Short answer: all of them
Long answer:
Learning your first language is always a challenge, and after your Java experience, a lot of other languages will seem a lot simpler. That said, the real challenge in learning programming languages is learning when to use a particular language -- you can find decent docs for whatever you choose when the time comes.
As a concrete start, hop over to wikipedia and browse their categorical list of programming languages, click on all of the names you've ever heard (and anything else that catches your eye) and if the article has a code example, give it a minute or two to sink in (the rest of the article will help, of course). The point here is not to master every single language (which is (1) pointless and (2) impossible), but to get a handle on what is out there. For any language, there is a handful of other languages like it, and if you can at least read one language in most of those categories, you will have mastered a fairly large chunk of the programming universe. When a new project comes up, and something about it reminds you of some language you found, you can just learn that language as part of doing the project. It may sound like a lot of work, but after, say, your fifth big language, you completely lose count and just accidentally learn new ones all the time without noticing.
When you stop relating to one language as your home-language, you'll be able to learn from examples in other languages even if you've never programmed in them. Personally, I've only written a few Haskell programs, but being able to read Haskell has exposed me to a lot of ideas that I could recycle in more practical Scala and Python programs (oh yeah, after you learn Python, give Scala a browse and you'll probably never use Java again)
Even finding the best language for the job isn't the whole story. Having a lot of tools in your toolbox lets you throw together amazing stuff in short amounts of time by writing each piece of your project in the easiest language your could. This may not be appropriate for all projects, but, boy, can you make some impressive demos.
It takes many years to get to the point where no programming language is totally foreign (or at least foreign for more than a day of hacking), but I think it is a very healthy and realistic long-term plan to attempt to conquer a representative sample of each rough category. Good luck!
Since Python wasn't my first language, I found the Python Cookbook helpful for learning
What Python was capable of
The idiomatic, of "pythonic," way to do something.
Programming language teaching has always been associated with a cliche statement while learning. "Write programs to learn programming". I too would suggest the same.
If you are going to start from basics. This is of course, the most suggested starting point. It is lengthy, but it is worth all the time. http://www.diveintopython.org/
Because you are into some Java, this might be even better for you. http://www.swaroopch.com/notes/Python. Start either python 2.x or 3.0. Me personally am a fan of python 3. But for a starter it could be hard to get samples, and references to programs online. So for you 2.x might be better. But I leave it upto you.
Like I started "Write programs..". You can start here.
http://www.spoj.pl/ - a programming challenges site, where you can choose from a wide variety of topics, mostly algorithms and has huge question database. Of course the choice of programming languages is upto you.
http://projecteuler.net/ - a mathematical questions site, here you just have to submit an answer, cheating is allowed here, so be free to borrow logic from others, but try writing the program yourself.
After you think you have gained sufficient proficiency in python, you can try recipes in this book python cookbook http://www.amazon.com/Python-Cookbook-Alex-Martelli/dp/0596007973.
For application development, after you think you can handle it, start on wxPython or PyQt. I personally would suggest PyQt. It is responsive, fast, and has decent development cycle, I have not used WxPython for long, but few programs I wrote, long back, didn't feel so great. Yet again, its upto you.
Which of the following technology is easy to learn and fun for developing a website? If you could only pick one which would it be and why
Clojure/Compojure+Ring/Moustache+Ring
Groovy/Grails
Python/Django
Ruby/Rails
Turbogear
Cappuccino or Sproutcore
Javascript/jQuery
Have you considered turning off the computer and going outside instead?
Remember to wear pants!
Have you tried ASP.NET MVC? It is actually very different to ASP.NET (vanilla), but retains your knowledge of the .NET framework. Most people wouldn't look back...
With the view based on your html (rather than whatever the controls decide to emit), it is also ideally placed to work alongside jQuery (it is even installed in the default project template) for all your dhtml/ajax needs.
Resources:
ASP.NET MVC in Action
jQuery in Action
OK, first, apparently we all need a pants check. Done?
I'm of two minds:
if you are looking for a practical language / platform to pick up that you hope to use to help you in your day-to-day then I'd go with Python/Django. Python has developed into a really sweat and powerful language and Django is as nice a web development MVC as any other and pretty easy to pick up and get going with. You can run it locally, its easy to deploy on Apache w/ mod_python. Did I mention that Python is a really nice language? Also good support in the tools world, google app engine etc....
if you are looking to expand your thinking/though processes about the way you program and think about programming then I'm with Joel Spolsky - choose HAppS (Joel would go Haslkell) or Clojure which I've not used but I've done a lot of lisp and it makes you think different and the language constructs like the macro capability will change the way you think of solving problems
I would probably learn Ruby on Rails. It has a lot of different methodologies compared to ASP.NET, and it might open your eyes to some different and very powerful approaches to web apps.
Let's start by clarifying your question. Why are you "tired of ASP.NET?" Is it because of the tedious webforms model that tries so hard to protect you from the browser/server conversation that it ends up getting in the way?
Or is it because you have been trying to work with one of the tiresome 3rd party enhancement controls that build on the tedium of the webforms model?
Or do are you simply tired of working with five different languages at once: ASP.NET, HTML, CSS, Javascript, and C#/VB?
If you answered yes to the first two of these questions here's some advice:
Get some rest.
Try ASP.NET MVC. It gets out of your way and lets you work with the browser and IIS
Realize that changing web development models will be difficult no matter which one you choose to move to. The path is smoother the fewer things you change (see number 2).
If you answered yes only to the 3rd question (five different languages) then all I can tell you is, welcome to web development. It will be this way for awhile.
I recommend Clojure and Compojure because Clojure is awesome. Clojure is a new and modern LISP implemented on the JVM and can interact seamlessly with any Java library. It already has 3 IDE plugins in development, a book written about it, a very smart and open-minded person running the whole operation and a great newbie friendly community. The language is simple, easy to learn and yet really powerful. A good way to open your mind to new ideas without going as far as pure functional programming. Coding websites with Clojure is a breeze and really fun. It has a lot going for it and a lot of momentum. All the kool kids are doin' it so I recommend giving it a try!
Javascript, because the skills you learn will complement your current Asp.net skills.
If you main goal is to broaden yourself, I'd suggest looking at things like Seaside or HAppS.
I would suggest jQuery or python, both are fun to work with and useful for either web work or just common tasks.
You should wait until you get an answer from someone who's used more than one of those. That said (I've only used rails, python, and javascript), one way to frame it would be as a balance between sheer intellectual joy and practicality. My thoughts on Rails and Python from that perspective:
Rails is going to be different and interesting, and it was hip in 2005-2007. There may be something more hip now. (Hip counts when you want to get future colleagues excited about what you've done, when they haven't done it.) I'd venture that it's at least as eye-opening as something based on LISP or Smalltalk or Haskell, but probably more practical because you may actually end up using it at a job or for contract work. Clojure, Seaside, and HAppS sound really cool, but until one of them really catches on, you're unlikely to ever use any of that stuff again in your career unless you're a computer science PhD working with other PhD's. (Edit in response to comments: please don't read this as a disparagement of those frameworks. As Rayne and MarkusQ have noted, depending on your motivations, they may be just what you're looking for. I'm just trying to communicate one method for weighing the alternatives based on your goals.)
Python is a great language to know all around. I haven't used Django, but it has some industry traction (not as much as rails). Python as a language though will serve you well no matter what you do -- it's great for banging out utility scripts and rapidly prototyping ideas. There's a huge community and tons of libraries.
You can gauge a technology's potential usefulness for moneymaking by searching for it on craigslist, dice.com, monster.com, etc.
Definitely clojure. It is the most different of all languages mentioned in the list, so it would be probably most fun to learn / use.
Nobody seems to be voting for groovy. I'd go for that. I don't know anything about grails, but groovy the language is pretty cool. In the past nine months at my job I've been required to learn python and ruby. In the process I also took some time to understand groovy. groovy is the language that had me hooked before I finished reading the first chapter of Groovy in Action.
Ruby is the one I'm actively using now, and while I did nothing but python for six months that's my least favorite of the bunch. Python is not a bad language per se, I just didn't enjoy using it. I find ruby to be a very pleasant language and am glad I had the opportunity to learn it.
Fully learning javascript might be the more practical choice, but I'd still vote for Groovy. I'm anxious to find an opportunity to use it at work.
Ruby on Rails, because that's what I use.
I have worked with several technologies... not touched ASP. NET. Heard about it from other people who are under its influence.
I have started working with Ruby on Rails and it is fun. Since you want to learn and develop web sites, you should go for Ruby on Rails. There are lot of things you can do with RoR on web. I like things that you can do with RMagick. (cropping images, thumbnails,slideshow etc)
Talk about multi-lingual sites... and there you have "gettext".
I vote for RoR.
I'll add in my vote for Groovy, as well as another one for Ruby. Both Grails and Rails are excellent frameworks, although Rails will get you a job a lot sooner than Grails. Both are truly a pleasure to work with, and have actually made me enjoy coding again.
Groovy is nice because you can use any Java library. So, lightning-fast database access, XML parsing, PDF generation, and so on. In a nutshell, Groovy is Java, if Java had been written by a bunch of Ruby guys.
Grails is also great, although it's a lot buggier than Rails, and if you want to do anything complicated you're going to need to learn a bit about Spring, Hibernate, and Java. Grails does have better internationalization support and more deployment options, as well as a really good integrated scheduler (Quartz) for long-running and scheduled tasks.
Rails is Ruby all the way down, so you can very easily read the framework code and figure out how things worked -- I did this in order to figure out how to implement a graph (data structure), and was really pleased with how easy it was to figure out how to change things.
Learn Ruby on Rails. It'll change the way you see web development. It did for me!
A valid alternative is Django and Python. I don't use it, but I consider it to be just as good as Rails.
I've used Ruby on Rails but also have done quite a bit of Groovy and Grails work.
If you don't have any previous experience I would go with either of those.
They're both fun to learn, pretty easy, and are very powerful.
They're both backed up by frameworks:
Ruby had Rails/Merb
Groovy has Grails
They can both use jQuery.
I don't know much about Python/Django combination.
I've started to learn Ruby on Rails along with MVC (since conceptually there similar) and found it a great relief from the same routine with .Net.
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 1 year ago.
Improve this question
It might seem it has been asked numerous times, but in fact it hasn't. I did my research, and now I'm eager to hear others' opinions.
I have experience with PHP 5, both with functional and object oriented programming methods. I created a few feature-minimalistic websites.
Professionals may agree about PHP not being a programming language that encourages good development habits. (I believe it's not the task of the tool, but this doesn't matter.) Furthermore, its performance is also controversial and often said to be poor compared to competitors.
In the 42nd podcast at Stack Overflow blog a developer from Poland asked what language he should learn in order to improve his skills. Jeff and Joel suggested that every one of them would help, altough there are specific ones that are better in some ways.
Despite they made some great points, it didn't help me that much.
From a beginner point of view, there are not one may not see (correction suggested by S. Lott) many differences between Perl & Python. I would like You to emphasize their strenghts and weaknesses and name a few unique services.
Of course, this wouldn't be fair as I could also check both of them. So here's my wishlist and requirements to help You help me.
First of all, I'd like to follow OOP structures and use it fundamentally. I partly planned a multiuser CMS using MySQL and XML, so the greater the implementations are, the better. Due to its foreseen nature, string manipulation will be used intensively.
If there aren't great differences, comparisons should probably mention syntax and other tiny details that don't matter in the first place.
So, here's my question: which one should I try first -- Perl || Python?
Conclusion
Both Perl and Python have their own fans, which is great. I'd like to say I'm grateful for all participation -- there is no trace of any flame war.
I accepted the most valued answer, although there are many great mini-articles below. As suggested more often, I will go with Python first. Then I'll try Perl later on. Let me see which one fits my mind better.
During the development of my special CMS, I'm going to ask more regarding programming doubts -- because developers now can count on each other! Thank you.
Edit: There were some people suggesting to choose Ruby or Java instead. Java has actually disappointed me. Maybe it has great features, maybe it hasn't. I wouldn't enjoy using it.
In addition, I was told to use Ruby. So far, most of the developers I communicate with have quite bad opinion about Ruby. I'll see it myself, but that's the last element on my priority list.
Perl is a very nice language and CPAN has a ton of mature modules that will save you a lot of time. Furthermore, Perl is really moving forwards nowadays with a lot of interesting projects (unlike what uninformed fanboys like to spread around). Even a Perl 6 implementation is by now releasing working Perl 6.
I you want to do OO, I would recommend Moose.
Honestly, the "majority" of my programming has been in Perl and PHP and I recently decided to do my latest project in Python, and I must admit it is very nice to program with. I was hesitant of the whole no curly braces thing as that's what I've always done, but it is really very clean. At the end of the day, though, you can make good web applications with all 3, but if you are dead-set on dropping PHP to try something new I would recommend Python and the Django framework.
I'd go with Perl. Not everyone will agree with me here, but it's a great language well suited to system administration work, and it'll expose you to some more functional programming constructs. It's a great language for learning how to use the smallest amount of code for a given task, as well.
For the usage scenario you mentioned though, I think PHP may be your best bet still. Python does have some great web frameworks, however, so if you just want to try out a new language for developing web applications, Python might be your bet.
I have no experience with Python. I vouch strongly to learn Perl, not out of attrition, but because there is a TON to learn in the platform. The key concepts of Perl are: Do What I Mean (DWIM) and There's More Than One Way To Do It (TMTOWTDI). This means, hypothetically there's often no wrong way to approach a problem if the problem is adequately solved.
Start with learning the base language of Perl, then extend yourself to learning the key Perl modules, like IO::File, DBI, HTML::Template, XML::LibXML, etc. etc. search.cpan.org will be your resource. perlmonks.org will be your guide. Just about everything useful to do will likely have a module published.
Keep in mind that Perl is a dynamic and loosely structured language. Perl is not the platform to enforce draconian OOP standards, but for good reason. You'll find the language extremely flexible.
Where is Perl used? System Admins use it heavily, as already mentioned. You can still do excellent web apps either by simple CGI or MVC framework.
I haven't worked with Python much, but I can tell why I didn't like about Perl when I used it.
OO support feels tacked on. OO in perl is very different from OO support in the other languages I've used (which include things like PHP, Java, and C#)
TMTOWTDI (There's More Than One Way To Do It). Good idea in theory, terrible idea in practice as it reduces code readability.
Perl uses a lot of magic symbols.
Perl doesn't support named function arguments, meaning that you need to dig into the #_ array to get the arguments passed to a function (or rather, a sub as perl doesn't have the function keyword). This means you'll see a lot of things like the example below (moved 'cause SO doesn't like code in numbered lists)
Having said all that, I'd look into Python. Unless you want to go with something heavier-weight like C++ or C#/Java.
Oh, before I forgot: I wanted to put an example for 4 above, but SO doesn't like putting code in numbered lists:
sub mySub {
#extremely common to see in Perl, as built-ins operators operate on the $_ scalar or #_ array implicitly
my $arg1 = shift;
my $arg2 = shift;
}
I recently made the step from Perl over to Python, after a couple of Perl-only years. Soon thereafter I discovered I had started to read through all kinds of Python-code just as it were any other easy to read text — something I've never done with Perl. Having to delve into third-party Perl code has always been kind of a nightmare for me, so this came as a very very nice surprise!
For me, this means Python-code is much easier to maintain, which on the long run makes Python much more attractive than Perl.
Python is clean and elegant, and the fact that LOTS of C APIs have been wrapped, gives you powerful hooks to much. I also like the "Zen of Python".
Beautiful is better than ugly.
Explicit is better than implicit.
Simple is better than complex.
Complex is better than complicated.
Flat is better than nested.
Sparse is better than dense.
Readability counts.
Special cases aren't special enough to break the rules.
Although practicality beats purity.
Errors should never pass silently.
Unless explicitly silenced.
In the face of ambiguity, refuse the temptation to guess.
There should be one-- and preferably only one --obvious way to
do it.
Although that way may not be obvious at first unless you're Dutch.
Now is better than never.
Although never is often better than right now.
If the implementation is hard to explain, it's a bad idea.
If the implementation is easy to explain, it may be a good idea.
Namespaces are one honking great idea -- let's do more of those!
As a Perl programmer, I would normally say Perl. But coming from PHP, I think Perl is too similar and you won't actually get that much out of it. (Not because there isn't a lot to learn, but you are likely to program in Perl using the same style as you program in PHP.)
I'd suggest something completely different: Haskell (suggested by Joel), Lisp, Lua, JavaScript or C. Any one of these would make you a better programmer by opening up new ways of looking at the world.
But there's no reason to stop learning PHP in the meantime.
For a good look at the dark side of these languages, I heartily recommend: What are five things you hate about your favorite language?
I suggest going through a beginner tutorial of each and decide for yourself which fits you better. You'll find you can do what you need to do in either:
Python Tutorial (Python Classes)
Perl Tutorial (Perl Classes)
(Couldn't find a single 'official' perl tutorial, feel free to suggest one)
In my experience python provides a cleaner, more straight-forward experience.
My issues with perl:
'use strict;', Taint, Warnings? - Ideally these shouldn't be needed.
Passing variables: #; vs. $, vs shift
Scoping my, local, ours? (The local defintion seems to particularly point out some confusion with perl, "You really probably want to be using my instead, because local isn't what most people think of as "local".".)
In general with my perl skills I still find my self referencing documentation for built-in features. Where as in python I find this less so. (I've worked in both roughly the same amount of time, but my general programming expereince has grown with time. In other words, I'd probably be a better perl programmer now)
If your a unix command line guru though, perl may come more naturally to you. Or, if your using it mainly as a replacement or extension to command line admin tasks, it may suit your needs fine. In my opinion perl is "faster on the draw" at the command line than python is.
Why isn't there Ruby on your list? Maybe you should give it a try.
"I'd like to follow OOP structure..." advocates for Python or, even more so if you're open, Ruby. On the other hand, in terms of existing libraries, the order is probably Perl > Python >> Ruby. In terms of your career, Perl on your resume is unlikely to make you stand out, while Python and Ruby may catch the eye of a hiring manager.
As a PHP programmer, you are probably going to see all 3 as somewhat "burdensome" to get a Web page up. All have good solutions for Web frameworks, but none is quite as focussed on rendering a Web page as is PHP.
I think that Python is quite likely to be a better choice for you than Perl. It has many good resources, a large community (although not as large as Perl, probably), "stands out" a little on a resume, and has a good reputation.
If those 2 are your only choices, I would choose Python.
Otherwise you should learn javascript.
No I mean really learn it...
If you won't be doing web development with this language, either of them would do. If you are, you may find that doing web development in perl is a bit more complicated, since all of the frameworks require more knowledge of the language.
You can do nice things in both, but my opinion is that perl allows more rapid development. Also, perl's regexes rock!
Every dynamic language is from same family. It does not matter Which is the tool you work with it matter how you do..
PHP VS PYTHON OT PERL OR RUBY? Stop it
As many comments mentioned python is cleaner well sometime whose curly brackets are use full to. You just have to practice.
I've been programming Ruby pretty extensively for the past four years or so, and I'm extremely comfortable with the language. For no particular reason, I've decided to learn some Python this week. Is there a specific book, tutorial, or reference that would be well-suited to someone coming from a nearly-identical language, or should I just "Dive into Python"?
Thanks!
A safe bet is to just dive into python (skim through some tutorials that explain the syntax), and then get coding. The best way to learn any new language is to write code, lots of it. Your experience in Ruby will make it easy to pick up python's dynamic concepts (which might be harder to get used to for say a Java programmer).
Try a python tutorial or book on learning python.
After running through some tutorials on-line (the ones posted so far look pretty good), find a current Ruby project you've done (or are working on) and re-write it in Python. I've used this technique to transition from various languages, and it's helped enormously.
I started learning from the python tutorial. It is well written and easy to follow. Then I started to solve problems in python challenge. It was a really fun way to start :)
I suggest just diving into Python, it's similar to Ruby so you should have no problems:
http://www.diveintopython.net/