How To Learn Python Effectively?

Knowing Java, how easy is it to learn Python?

  • I'm a Java developer and that's all I've written for 5 years, but I need to get on this project that is written in Python. How long should it take to gain reasonable expertise in Python. And what's the most common/convenient IDE for Python? Its uses the PyPy compiler.

  • Answer:

    You should become comfortable with the syntax in a few weeks. You may require a year or more to write idiomatic Python; while this may make you less productive or more prone to stumbling, this will not prevent you from accomplishing real work in the meantime. You can expect to become comfortable within a few weeks, and proficient within a few months. Python does not have an IDE that is as widely used as Eclipse is for Java. http://wiki.python.org/moin/PythonEditors is a list of Python editors. I do not know what OS you use and what you are using Python for, but for Linux I recommend http://ninja-ide.org/ and https://code.google.com/p/spyderlib/. Spyder is intended for scientific computing, and Ninja is intended web development, but both could be used for any variety of work with Python. IDLE and IPython are commonly used and are cross-platform. Also note that many Pythonistas do not use an IDE; you may choose to write Python in a text editor like vim or Sublime Text.

Gavin Hackeling at Quora Visit the source

Was this solution helpful to you?

Other answers

PyPy is one of the ways to run Py code in a similar fashion as you're used to doing in Java. I.e. through a JIT compiler. Think of PyPy as the JVM for Python, though that's not an exact analogy - but should suffice to explain. There are very few differences between various Python implementations (CPython, IronPython, Jython, PyPy, etc.) ... much more between Py 2 and Py 3. That said, you should be able to do much the same thing in Python as you can in Java. Although it doesn't require classes, it can still do it in the same manner as Java can. Lots of things in Python would feel like shortcuts to doing in in Java. E.g. say you want to use a dictionary. You'd have made a hashmap (or similar): Map<String, String> map = new HashMap<String, String>(); map.put("key1", "data1"); map.put("key2", "data2"); System.out.println(map.get("key1")); You'd write the same thing in Python like this: map = dict() map["key1"] = "data1" map["key2"] = "data2" print map["key1"] Or even simpler: map = {} map["key1"] = "data1" map["key2"] = "data2" print map["key1"] Or you can directly initialize the dictionary to contain the key - value pairs in one line: map = {"key1" : "data1", "key2" : "data2"} print map["key1"] But I'd advise getting a book/tut on the basics, just so you can get to grips with these syntax differences. Then also figure out these "tricks". Don't worry too much about the more functional stuff at first - you can get around with Python without using map, zip, and their siblings for quite some time. There's nothing wrong with while and for loops. But once you get into those functional ideas you'll hate going back to the old imperative ways and look into doing similar in Java as well. Edit: As for IDE ... there are many. But you only really need a decent code editor. Most of them come with syntax highlighting. Some even with code completion and auto-indent (much more important than with java as your indents are analogous to Java's open and close brackets). One thing you may need to wrap your head around is the REPL (Read-Evaluate-Print-Loop). It's where you'll do the debugging and trying out code ideas. You'll not need to do the compile-to-check-if-it-compiles-then-test-for-runtime-bugs so much as read-it-into-interpreter-evaluate-a-function-see-the-result-and-repeat.

Irné Barnard

It is much easier to play with Python than with Java, because of the builtin IDE (in Windows) and interactive mode. There is also no compilation phase so iterating over play code is quickier. As for syntax, Python is much „lighter” and less enforcing (due to dynamic typing), and actually much more fun to play with - I learned Java before Python, but never looked back.

Alex Urbanowicz

Related Q & A:

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.