I left Python learning because of Python 2 vs 3 [closed] - python

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 11 years ago.
I wanted To learn how to program for the first time.
Because i`m mainly practice on IT and Security, I choose to start with Python.
But, As is started to learn Python 3, I came to realize that Non of the modules I wanted to use were ported to Python 3, and even Django (one of the main reasons I wanted to learn python) and IronPython does not support python 3.
From my view, Python is not recommended for newbies because 1) Python 2 is about to be "out of future support" (the 2.7 is the last one). and 2) the Python 3 is not supported by the all important modules and frameworks...
So - someone who wants to learn python from scratch and not wasting time on a version that is about to be out of support (2), as no any good options (nor 2 or 3 version)...
Please correct me if I`m wrong (and before I move to C# :) ).

Hello
I had the same question because I began to learn Python 2 months ago.
So after reading some posts and informations, I decided to start with Python, 2.71, why?:
1/ Python 2.7.1 is really stable and has all the great libraries.
2/ It will be maintened for a long time for all the bugs (but not for the functions) so there will be 2.7.2 2.7.3...
3/ You may use the 3.xx syntax in your 2.7 code with the __future__ statement.

Python 2 and Python 3 are close enough that learning on the earlier version will give you a very solid grounding for migrating to 3 when it becomes more mainstream.
Abandoning a language just because it's transitioning to a new version is a bit silly, frankly.

This is really subjective, if you ask me. In my opinion, learning Python 2 is not "a waste of time". Python 3 is very similar to Python 2, so switching to it whenever the time comes will be pretty easy.
Also, Python 2 is not "out of future support". It will be a long time before it is completely discontinued. By that time, most modules will be ported and Python 3 will be fully usable.
Also, check out 2to3, which will greatly aid the, well, 2 to 3 switch.

+1 to all the replies you've received already. Yes start with Python 2, especially as you want to use libraries that are only available in 2. But whilst you are doing this, check what the differences are. The one that has bitten me is the change to print. Very minor but If I'd written all my prints in a python3 style in the beginning, porting to 3 would have been trivial (python 2 supports the function style print).

Related

different types of scripting in linux [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
I am very new to linux, and i want to learn scripting. It seems like there are quite a few options to learn about scripting from bash shell scripting, python, perl lisp, and probably more that i dont know about. I am just wonder what are the the advantage and disadvantage of all of them, and what would be a good place to start?
The most basic form of scripting is a Bourne shell script. This can be as simple as multiple commands put in a file, one command per line.
# simple shell script example
clear
ls
This is an example program that clears the terminal screen, then lists the files in the current directory. For this example, a shell script is by far the easiest way to do it.
In my experience, once Bourne shell scripts gain a bunch of features, they become very difficult to maintain. Also, if you ever need to work with filenames or directory names that can contain spaces, it is very painful to properly quote your variables so that the script works correctly. A more modern scripting language then becomes a boon.
My personal choice is Python. It's easy to learn, and you will never find that it is not powerful enough for any problem. You will also find that six months after writing a Python script, you will still be able to see what it does without needing to concentrate furiously and reverse-engineer the code in your head.
I recommend you find a good book, and read it and do the exercises. If you use a Python book you will start with Python; if you get an advanced UNIX book it will teach you shell scripting.
Every programmer will have a biased answer to this, but one thing to keep in mind is what your goal is. For instance, if you're only looking to be a successful sysadmin, then your goals might best be served by learning languages that are more conducive to sysadmin tasks (e.g. bash). However, if you're looking to do more general programming, including data analysis, you might be better served focusing your study on more general-purpose languages like Python or Perl. For web development, Ruby might be worth studying, etc. It really depends on why you're interested in learning scripting.
If you don't really have a specific reason and are looking for general advice, it's probably wise to start with one language and get proficient at it and then expand to other languages. The canonical path would probably be bash --> Python, these days. Of course, this is just one person's opinion. :-)
I think a lot of times, people new to programming see all the options out there and don't know where to start. You listed a bunch of different languages in your post. My advice would be to pick one of those languages and find a book or tutorial and work through it.
I became interested in "scripting" from just trying to come up with a mIRC script that would fit my needs; however, after completing that, I changed OS from windows to Linux and mIRC scripting no longer would work for me. So I started playing with Perl and Python to see which would work best for xChat.
Eventually, what it all boils down with is that you'll need to experiment with a language and do some hands on learning. I eventually completed project, and used PHP for it. While completing that, I also was working through Michael Hartl's tutorial and worked with Ruby on Rails some. Now I'm in the process of rewriting it using Node.js (javascript).
Best bet, just pick one language and start playing with it.

What other Language synergizes well with Python? Need Advice [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 9 years ago.
Ok so I know the basics of programming languages, I've studied python and liked it a lot. I'm studying now the intermediate parts of python and I'm catching the concepts already. I'm working with a project and at the same time solving computer problems that practices algorithm use. I've learned that python has limitations and wants to compensate that limitations by learning another programming language.
What programming language do you suggest that synergizes well with python? I want something who can give me their actual experience while working with python and the language that complements well with it. Answers like "try iron python or jython blah blah blah" won't help, if you can give me it's pros and cons, it's maturity it's problems then that's good enough for me... Thanks a lot
EDIT -
Sorry guys, I think I need to add some details in this. I'll be using python mainly for web programming or game development. So if you think this language A would help me in python for web programming then that's it.
What is wrong with IronPython or Jython? You can learn how to write libraries in Java or .Net to alleviate some of Python's speed problems. Learning to write your own Python libraries will certainly help you better understand and overcome the limitations you mentioned.
For me, the obvious choice to learn after Python is C. C is a lower level language, so you're dealing with more elemental computer concepts than objects, but it will give you the understanding necessary to write extensions to Python.
That way, it will be easy to write your programs in Python, and then migrate parts to C for speed--either by writing an extension or by using a bridge language like Cython.
If you run into performance problems (which might be an issue in game programming), C/C++ programs can be integrated well into Python scripts and vice versa:
Extending and Embedding
Python/C API
But I haven't yet seen the need to do so myself.
When you're quite comfortable with Python, Common Lisp and Scheme are good languages to learn about functional programming. I've been learning CLisp myself lately and there are a lot of "ahah!" moments that make it a lot of fun.
IronPython and Jython are great tools to learn if you plan on entering the professional world - there is tons of development right now in C# and Java - they're pretty much the hot languages of the professional world. IronPython integrates with all of the .NET languages, while Jython of course integrates with Java. So your choice there should reflect your desire to work at a .NET company, or not. Both IronPython and Jython are well matured languages.
Others have already mentioned C/C++ which are good choices if you're not familiar with them, and if ~30-40 years of programming life, and Top 3 rankings for July 2010 on the TIOBE index is not a strong enough reason to learn them... well you probably have other issues ;)
If you're looking at newer languages that haven't really been tested hard-core, you have languages like Ruby (which seems to be the new sexy), and Go by Google.
Perl is a bit like Ruby in that there is quite an overlap between Python and Ruby/Perl, and the areas they cover.
If I were to pick another language, already knowing Python, I'd go with a compiled language - maybe lower level like C\C++. I guess it really can be determined by what you want to do. If you want to work for a .NET company (which may or may not imply you really love Microsoft products), IronPython and a .NET language (C#, VB) is the way to go. OTOH, if you want to work for a company like Google (which happens to employ a certain individual), they extensively use Java and Python, so it's probably better to learn Jython.
I guess the question you need to ask yourself is, "Where do you I want to go today tomorrow?™"
Haskell or Ocaml, or maybe a Lisp dialect such as Common Lisp or Scheme.

When Should I Start Thinking About Moving to Python 3? [duplicate]

This question already has answers here:
Closed 13 years ago.
Possible Duplicate:
Why won't you switch to Python 3.x?
I see there are already a lot of duplicate questions asking whether or not new Python programmers should learn 2 or 3. I am not asking that question.
I am already a Python 2 programmer. I started tinkering with it some years ago. I started using it almost exclusively for my personal projects about a year ago. I even recently switched from a PHP job to a Python job. However, all this has been with Python 2.
Python 3 is out now, and I know that is is not backwards compatible with 2, although it is similar. I don't think I'm going to have any problem learning Python 3. However, I am going to have a problem transitioning old code, if it becomes necessary. Also, if development efforts move from Python 2 to 3, I can't be stuck developing on a deprecated platform.
It seems that for the moment, Python 2 is still going strong, and there isn't really any push to transition to 3. That can't last forever, though. When should I start to make a move?
The best answer I can give you is change when you need to. If you have no need for Python 3, then don't switch. If you aren't sure if you need to switch, chances are that you don't.
That said, once Python 3 becomes the more widely used version (in a few years, not anytime soon), you'll probably want to switch just because it will be more supported (more libraries, etc).
If you don't have any Python 2-specific libraries, you could write new projects in Python 3 just to ease the transition, but you don't need to at this point.
If you can switch now, you might as well. Learning the newest will always help in the future.
Being that you have been using 2, then there is no concern that you won't know how to use that.

I know Perl 5. What are the advantages of learning Perl 6, rather than moving to Python? [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 11 years ago.
Coming from a Perl 5 background, what are the advantages of moving to Perl 6 or Python?
There is no advantage to be gained by switching from Perl to Python. There is also no advantage to be gained by switching from Python to Perl. They are both equally capable. Choose your tools based on what you know and the problem you are trying to solve rather than on some sort of notion that one is somehow inherently better than the other.
The only real advantage is if you are switching from a language you don't know to a language you do know, in which case your productivity will likely go up.
Python does not have Junctions. In fact I think only Perl has Junctions so far. :-)
In my opinion, Python's syntax is much cleaner, simpler, and consistent. You can define nested data structures the same everywhere, whether you plan to pass them to a function (or return them from one) or use them directly. I like Perl a lot, but as soon as I learned enough Python to "get" it, I never turned back.
In my experience, random snippets of Python tend to be more readable than random snippets of Perl. The difference really comes down to the culture around each language, where Perl users often appreciate cleverness while Python users more often prefer clarity. That's not to say you can't have clear Perl or devious Python, but those are much less common.
Both are fine languages and solve many of the same problems. I personally lean toward Python, if for no other reason in that it seems to be gaining momentum while Perl seems to be losing users to Python and Ruby.
Note the abundance of weasel words in the above. Honestly, it's really going to come down to personal preference.
Perl is generally better than python for quick one liners, especially involve text/regular expressions
http://novosial.org/perl/one-liner/
Python has one huge advantage: it's implemented, there's a rather stable compiler for it.
Perl 6 (renamed Raku in 2019) is a rather visionary language, with a stable compiler and test specification released in 2015. It has a set of very cool features, among them: junctions, grammars (yes, you can write full parsers with Raku "regexes"), unicode handling at the grapheme level, and lazy lists.
In your particular case when you know Perl 5 you'll get familiar with the Raku (née Perl 6) syntax very quickly.
For a more comprehensive list of what cool features Raku has, see https://raku.org/ or alternatively, the FAQ.
Python has a major advantage of being available in a production-ready format today.
Python has Jython and IronPython, if you need to work closely with Java or the .net clr.
Perl 6 has the advantages of being based on the same principles as Perl (1-5); If you like Perl, you'll like Perl 6 for the same reasons. (There's more than one way to do it, etc.)
Perl 6 also has an advantage of being only partially implemented: If you want to hack on language internals or help to define the standard libraries, this is a great time to get started in Perl 6.
Edit: (2011) It's still a great time to hack on the Perl6 internals, but there is now a much more mature, usable Perl6 distribution, Rakudo Star. If you want to use Perl6 today, that's a great choice.
You have not said why you want to move away from Perl*. If my crystal ball is functioning today then it is because you do not fully know the language and so it frustrates you.
Stick with Perl and study the language well. If you do then one day you will be a guru and know why your question is irrelevant. Enlightment comes to those to seek it.
You called it "Perl5" but there is no such language. :P
IMO python's regexing, esp. when you try to represent something like perl's /e operator as in s/whatever/somethingelse/e, becomes quite slow. So in doubt, you may need to stay with Perl5 :-)

Best online resource to learn Python? [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 11 years ago.
Locked. This question and its answers are locked because the question is off-topic but has historical significance. It is not currently accepting new answers or interactions.
I am new to any scripting language. But, Still I worked on scripting a bit like tailoring other scripts to work for my purpose. For me, What is the best online resource to learn Python?
[Response Summary:]
Some Online Resources:
http://docs.python.org/tut/tut.html - Beginners
http://diveintopython3.ep.io/ - Intermediate
http://www.pythonchallenge.com/ - Expert Skills
http://docs.python.org/ - collection of all knowledge
Some more:
A Byte of Python.
Python 2.5 Quick Reference
Python Side bar
A Nice blog for beginners
Think Python: An Introduction to Software Design
If you need to learn python from scratch - you can start here: http://docs.python.org/tut/tut.html - good begginers guide
If you need to extend your knowledge - continue here http://diveintopython3.ep.io/ - good intermediate level book
If you need perfect skills - complete this http://www.pythonchallenge.com/ - outstanding and interesting challenge
And the perfect source of knowledge is http://docs.python.org/ - collection of all knowledge
If you're a beginner, try my book A Byte of Python.
If you're already experienced in programming, try Dive Into Python.
I think Python Challenge is great.
It's not about learning Python (syntax) but presents you small and fun riddles. Solving the riddles is based on Python but you can use whatever fits (your calculator, bash scripts, Perl...). After you solved one, you get to see how others have solved it and can discuss the pros & cons of the different ways.
Very nice to get a feel for how things could be done (smart) in Python. This site works especially well if you know a bit about other scripting languages or the commandline, etc.
The tutorial at Python's homepage is a good place to start. Also, there are some screencasts here.
These are unvaluable online reference tools:
Python 2.5 Quick Reference
Python Side bar
Other online resources for beginners:
A good python blog for beginners: http://www.learningpython.com/
Python Video at Google Code
Think Python: An Introduction to Software Design
The Python tutorial is actually pretty good.
There's also a video series on showmedo about python.
Between those two resources, you should have more than enough to learn the basics!
You can look at Building Skills in Python, also. It presumes some level of experience in programming.
If you're really new, try Building Skills in Programming. It includes a lot of background and fundamentals.
Google's Python Class
Welcome to Google's Python Class --
this is a free class for people with a
little bit of programming experience
who want to learn Python. The class
includes written materials, lecture
videos, and lots of code exercises to
practice Python coding. These
materials are used within Google to
introduce Python to people who have
just a little programming experience.
The first exercises work on basic
Python concepts like strings and
lists, building up to the later
exercises which are full programs
dealing with text files, processes,
and http connections. The class is
geared for people who have a little
bit of programming experience in some
language, enough to know what a
"variable" or "if statement" is.
Beyond that, you do not need to be an
expert programmer to use this
material.
There are some screencasts on http://showmedo.com
I learned from the Python Tutorial!
+1 for Dive Into Python
The python manual
Its a bit long winded sometimes but it tells you all you need to know to get going.
PLEAC , has a Python Cookbook , which is very helpful .
Learn Python in 10 minutes
The Cookbook is absolutely essestial if you want to know idiomatic python.
I consider ActiveState's Python community to be a great resource. Also
DZone Snippets can be useful.
I first ran across Software Carpentry looking at lists of python tutorials.. but its a lot more than a tutorial on python. turns out what I really learned was how to use subversion, and that none of my projects are better suited to python than to perl... yet.
Also consider [Hands-On Python](http://www.cs.luc.edu/~anh/python/hands- on/). It is used as a primary text for Computer Science 150 at Loyola University. It is concise intro to Python while emphasizing good programming style and design.
The Hazel Tree
Python Cookbook is very useful.

Categories