Python - Yahoo News Search Results

Python Challenge will return to Florida Everglades in 2016

Florida is bringing back a public hunt for invasive Burmese pythons in the Everglades.  The Florida Fish and Wildlife Conservation Commission plans to hold the next Python Challenge early next year. Registration opens in October. About 1,600 people participated in 2013 during the first month-long python hunt on state lands. Most of the 68 pythons collected were caught by experienced hunters ...

Stephen Hawking sings Monty Python

'Monty Python': Where are they now? 7 photos From left, Graham Chapman, Eric Idle, Michael Palin, Terry Jones, John Cleese and Terry Gilliam (foreground) in 1975's "Monty Python and the Holy Grail."

Stephen Hawking sings Python song

Famed cosmologist Stephen Hawking has proved his comedy chops on shows like "The Big Bang Theory," and now he's trying his hand at musicals.

Stephen Hawking Covers Monty Python Classic

Last year he appeared on film during Monty Python's live shows, but now Professor Stephen Hawking can be heard covering one of the comedy troupe's classic songs. The physicist sings the famous Galaxy Song, which is being released digitally this week and will be available on vinyl this weekend as part of Record Store Day 2015. In the video, the A Brief History Of Time author can be seen whizzing ...

How Monty Python and the Holy Grail Influenced Film by Satirizing It

Any writer, comic or otherwise, can attest that beginnings are the hardest part, but Monty Python never seemed to have that problem. Television was still chintzy and cheerful when Monty Python first aired in 1969, so to satirize it, the show had to be as dramatic as possible. The trappings of film are inherently epic, particularly in 1975, and in scraping together the funds to make Holy Grail ...


recent bookmarks tagged Python

Why is Python used for high-performance/scientific computing (but Ruby isn't)? - Programmers

Posted on 18 January 2038

Posted on 3 April 2015

Posted on 3 April 2015

Posted on 3 April 2015

Notebook Gallery

Posted on 3 April 2015

Python Programming Resources -

Posted on 2 April 2015

Here's a big list of Python Programming resources : learnpython

Posted on 2 April 2015

Valued Lessons: python

Posted on 2 April 2015

Python - 十分鐘入門 « I try | MarsW

Posted on 2 April 2015

Talks and Presentations

Posted on 1 April 2015

Top Answers About Python (programming language) on Quora

Top Answers About Python (programming language) on Quora

How do you scrape websites that use services like Brassring (e.g., GE Careers)? Also, how do you use the scraping to navigate to separate pages?

Here I have one of the best data scraping service tools that provides web scraping service and latest technology to deliver successful web scraping of information from websites.

It scrapes webpage, HTML, pdf, social websites, local listing, wiki, online shops, ecommerce sites, blog, podcast, and online internet resources like directories, reviews, product description; and change them into more structured formats like Excel, CSV, XML etc.

It is called as “Easy Data Feed”.

You can read about how to use it here: Page on
They also have developers, you can hire them to do the job for you, and their Skype is “easydatafeed”

See Questions On Quora

Posted on 10 June 2015

Isn't dynamic programming much simpler coding in languages like Python (and others) rather than Java (C/C++)?

It can indeed be simpler. The main reason is that (as opposed to Java and C++) Python can actually do the memoization for you automatically.

from functools import lru_cache

def fib(n):
    if n <= 1: return n
    return fib(n-1) + fib(n-2)

print('F(100) = {}'.format(fib(100)))

This code prints "F(100) = 354224848179261915075" in a matter of milliseconds.

Still, note that there are hidden constant factors both in the time complexity and in the memory consumption of this implementation. Only use it if you have enough of both these resources. Usually you'll run out of memory first. If that happens, you'll have to switch to a language that gives you more control. Or buy more memory :)

See Questions On Quora

Posted on 31 May 2015

If I had to choose between learning Java and Python, what should I choose to learn first?

But first ... regardless of the language that you choose, you will do better with it if you learn the fundamentals of computer science in parallel with your language studies. It has seemed to me that programmers who work without much knowledge of the "guts" of a computer's execution never seem to be as good as those who have the safety net of a deeper understanding, and those who lack depth in CS never become excellent. 

Although I bill myself as 98% biography free, for this answer a sentence or two is required. Ending in 2004, I taught in the Department of Computer Science | VCU School of Engineering at Virginia Commonwealth University. The CS program at VCU was Java-oriented, in the sense that Java was the declared teaching language. In the 1990s I lived and worked in and around Silicon Valley, primarily getting my work done in C++. In the 1980s, it was C and Fortran.

I now work (but I do not teach) four miles down the street at University of Richmond, where we are a Java and Python-3 shop. We have purchased a number of vendor authored packages, but we glue them together with python, and some of the faculty are python proponents.

Teaching in the EE program a decade ago, I often seemed to be de-programming the students who had started in Java. For the classes I taught, most of the students were upper division. They knew very little about the most useful construct in programming: the pointer. The idea that there were non-class objects in other languages baffled them. Internal representations of data in memory were foreign. But that's why they are getting a university degree, yes?

At University of Richmond, and I once again find myself flummoxed by the operational contrasts between Java and Python, and I believe they are connected to learning.

1. Python requires no "set up." A full python environment is already on every Linux machine, and on Macs. On Linux, the program yum, or the Yellowdog Updater, Modified is written in python, so python is here to stay. Java requires a substantial amount of setup. So if you want to get started with python programming, just type python at the prompt. Now. That's it. To start with Java, call someone who knows it.

2. The systems written in Java that we have purchased all suffer from the need to have particular versions of Java installed, and thick clients of these systems also have that requirement. Support of Java appears to be expensive. We do not yet have a similar number of python systems, but no one is expecting configuration management to be an issue with them. From an educational standpoint, this sounds like a good way to become frustrated.

3. Python has its own idiosyncrasies. In Java, every object must be a memory of some class, but in python the "variables" are of a unique flavor. Variables do not represent objects [cf. object: something in memory that has an address] nor are they pointers, nor are they references. It is best to think of them as temporary "names" for an underlying reality, much like the Allegory of the Cave in The Republic (Plato). From a learning standpoint, this may be more difficult for those of us with 35 years of experience than it is for those first taking up programming.

4. A number of companies are stuck with a great deal of legacy code written in Python 2. Consequently, Python suffers from a misconception about how strict or loose the typing system may be, and how strictly it may be enforced. Keep in mind that because Python mainly works with "names" of objects, we are really not discussing the same thing when we discuss types of Python's objects that we are discussing in other languages. Python does offer some rather seamless type conversions that can make it seem that the concept of types is less strict than it is in fact. Learning Python 3 first makes sense, but most of the employment is still in Python 2.

5. Compared with Java, python is terse. Personally, the growing amount of arthritis in my hands welcomes this feature. In truth, my C++ code was frequently criticized for its overuse of operator overloading and the ternary operator. This may not make it a good learning experience, because for many people learning comes more easily when the material is spelt out.

6. If you plan to make a generalized career of programming, choosing a language based on employment prospects is pointless. In the past three and a half decades of continuous employment, I have made money from and forgotten the following languages: 6502 assembly, 8086 assembly, Fortran 66, Pascal, ... You get my drift. Now I am all Python all the time, except when I am asked to do Java.

But finally ... go back and read the "but first" section.

See Questions On Quora

Posted on 17 May 2015

Can an operating system be written completely in Java or Python? What are the difficulties associated with writing an OS in Java or Python?

An OS has to run on top of the hardware. High level languages like Java and Python run in a VM, and a VM runs on top of an OS. Technically, you cannot take a JVM and turn it into an OS.

If you do want to write an OS in Java/Python, you will have to first implement a compiler that takes Java/Python code and converts it into machine code. And that means you will have to implement a compiler for each kind of hardware that it will run on

Of course your Java/Python program needs access to the underlying hardware too right? But these programs are designed to work at a level of abstraction above the OS. For example, a FileOutputStream assumes that there is an OS that manages the file system. However, if you don't have an OS, you don't have a file system. Your OS has to provide the file system. This means that your code will need some way of sending commands to the disk. This means you need to provide API that can send commands to the disk.

Essentially, this means that you have to throw away all the APIs that are specified by Java/Python, and come up with a whole new native API that can access the hardware.

What you will end up with is a new language that is uses Java/Python syntax!

See Questions On Quora

Posted on 7 May 2015

How do I learn a programming language (Python) without a strong background in computer science? What strategies/materials do you use?

I did not begin with a computer science background, but I've still made a career in the field of writing software. How did I do it?

1. I coded. A lot. From silly little scripts to automating tasks to attempting full-blown projects. At work or for fun. I failed a lot, but learned along the way.

2. I didn't jump from language to language. Instead I stayed in a few places for years and focused my learning on those tools. My 18+ year career can  be summed up as FoxPro then Java then Python. In the middle of things I picked up JavaScript. Sure, I've dallied with a few things (Haskell, Lua, Perl, ColdFusion), but by staying with a small set of tools I'm better than mediocre.

3. I coded lots. Yes, this is a repeat of #1.

4. Once I get the basics of a language, I look up best practices for each of them. Then I religiously adhere to them, even becoming dogmatic about it. In general this means my code is more easily read. More easily debugged. And most importantly, more easily shared.

5. Did I mention that I coded a lot? You can never get good at anything unless you practice. Another repeat of #1.

6. I got over my fear/pride of asking questions. Well, mostly, I still am afraid/prideful from time to time. Honestly, by asking questions you aren't showing what you don't know, you are showing you are willing to learn. Also, the simple act of figuring out how to ask a question can put you in the right mindset to determine the answer yourself.

7. As soon as I asked a question, whether or not I got an answer, I coded some more. Code, code, code! Yet another repeat of #1

8. Once I've gotten the hang of a language, I look for cookbooks and/or pocket references on it. I always get paper. The recipes in the cookbook become the foundation of your toolkit. The terse, easy-to-find reminders in the pocket reference mean less cognitive overload.

9. I take those recipes and references and coded with them. Again and again I code. In work hours or play time. Practice makes perfect! Why do I keep repeating #1?

10. Over the years I've stayed with the easiest-to-learn stable IDEs/text editors. Yes, I know there are really powerful tools out there (Vim, EMACS, PyCharm, etc), but I don't want to have to stop what I'm doing to learn new tools. I want to code, not tinker with desktop tools or arcane text editors.

11. And again, reference back to #1, I use the text editor to write code. Code, code, code! Until my fingers and hands hurt, until I've had to learn how to deal with carpal tunnel syndrome. Code, code, code! It's like learning martial arts, guitar, or anything, repetition of simple actions provides the confidence for you to either combine those actions into something greater or learn something more complex.

One last thing, if I had the chance to do it all over again, I would have gotten a computer science degree. Then I would have followed these steps. While nothing compares to experience and practice, periodically I am stopped cold by things a person with a formal CS background considers trivial.

See Questions On Quora

Posted on 5 May 2015

Why are IT systems in big enterprises usually built using Java, instead of Python or JavaScript?

1) You have consistent performance through the JVM.  The performance characteristics of the JVM are pretty well known, and you can pretty easily take legacy code and add hardware to make it work.

2) A terrible programmer can do a lot less damage with java than they can with python or javascript.  Python and javascript are written so that if you have a terrible programmer, they can do something to create hard to track bugs that crash the whole system.  If you have a terrible programmer in java, they can do less damage, and the thing is modular enough so that you can work around the bad programming.

If you have a 1000 programmers and 1 of them is totally incompetent, then they aren't going to be able to single-handedly destroy the system.  Whereas with javascript and python, one incompetent programmer can single-handedly destroy the system.

See Questions On Quora

Posted on 5 May 2015

Is the book "Think Python: How to Think Like a Computer Scientist" still up-to-date and useful for learning Python?

Yes, Think Python is still up-to-date.  It uses Python 2, which you probably know is being replaced by Python 3, but for people starting out, it doesn't matter very much which version of Python you learn.  There are only a few differences beginners will encounter, and the book points them out as they come along.

That said, we will probably do an updated version for Python 3 in the next year.

See Questions On Quora

Posted on 4 April 2015

How do you identify a good programmer?

A good programmer is someone who understands the larger picture of programming. Not just from a technical perspective. They know multiple methods of solving a problem and can pick the best one. They know when to use existing libraries/source and when to tackle a problem themselves. They can balance clarity and complexity. They know when to optimise and when not to. They understand that maintaining messy code is far more painful and takes far longer than initially writing it. They also understand where to put in effort and when to give up on something.

I once worked with a guy who described himself as a 'hacker'. He was knowledgeable about programming and could get things done, but he refused to change is attitude regarding comments, style and naming conventions. Basically his code was an impenetrable, commentless mess of single-letter global variable names, short cryptic function names and inconsistent non-conformist style. That's cool if you are working alone and nobody has to see what you've written. But that kind of attitude has no place on MY team.

I would take an amiable programmer who produces slow clear code to an egotistical rock-star who produces fast but buggy obfuscated gibberish any day.

See Questions On Quora

Posted on 24 January 2015

Why are IT systems in big enterprises usually built using Java, instead of Python or JavaScript?

Big enterprises have been around long enough to recognize a few things about software development and organizational behavior:
  • Software lives a long time
  • Many programmers will have their hands in a piece of software over its service life
  • Those programmers will have varying levels of competency
  • Those programmers will have varying levels of communication with prior programmers, including "none at all".
Java has two major advantages over Python and Javascript:
  • Static typing. Programs are self-documenting; programmers never waste their time pondering questions like "what is this variable?", "what is the contract of this method?", "who calls this method?", "who overrides this method?". Giant categories of bugs (eg, passing in the wrong type to a function) are eliminated, reducing the test footprint and mitigating the damage caused by inevitable programmers who get sloppy with tests.
  • Robust IDE support, made possible by static typing. Modern Java IDEs practically write code for you - but more importantly, they make it easy to navigate an unfamiliar codebase. Navigating to method definitions is a simple command- (or control-) click. Hovering over methods shows you documentation. The answers to all of those questions above are just a click away. If you type anything that's even slightly wrong, the IDE puts a red squiggly underline under the problem area. And if you want to make major changes across a codebase no matter how large, automatic refactoring is quick and reliable.
These two aspects, more than anything else, make it comparatively easy to scale Java codebases to high levels of complexity. When you have dozens (or hundreds, or thousands) of engineers adding code to a running business, you end up with very complex systems even when you have top-notch programmers - and any large organization cannot count on this always being the case. Not even Google.

Javascript in particular is worth singling out as extraordinarily poorly suited for scaling into complex systems because of the need for asynchronous programming. The business rules for a large enterprises are often byzantine; forcing them into an asynchronous model magnifies the complexity tenfold.

On a personal note, I work professionally in Java, Python, Javascript, and Ruby. I have had the dubious pleasure of working on two nightmare-scenario codebases: Electronic Arts' core platform (all Java), and CloudFoundry (almost all Ruby, although that is changing). Both are enormous; both are full of code whose original developers have departed; both include the output of programmers of wildly varying skill; both are founded on poor architectural practices. Between the two, the Java codebase was significantly easier to "jump into" - even though it was significantly larger. The worst-case-scenario for dynamic languages is far worse than the worst-case-scenario for static languages.

See Questions On Quora

Posted on 20 January 2015

Why are IT systems in big enterprises usually built using Java, instead of Python or JavaScript?

Questions like this are usually asked by those with limited experience in large systems development, often after having just learned programming or done some small project work in the first languages they've acquired knowledge in.

For starters, neither Python or JavaScript are modern languages compared to Java.  JavaScript is only a couple of years younger than Java and before that it was called LiveScript.  Python is OLDER than Java by several years.

"Modern" does not mean "better".

Talking to other systems is a function of protocols, not languages.  You need to understand that distinction.  As long as you can speak the protocol, like HTTP or SOAP, you choose the language best suited for the job.

Java is NOT legacy.  It is mainstream.  And it is mainstream for a reason.  Virtually all of the common enterprise tasks one might want to perform is available in Java either natively or through many frameworks. 

It can scale and has many years behind it in how to do this.  That is huge in large enterprises with high volume systems.  JavaScript libraries are playing catch-up here and it will likely be 5-10 years before they work out all of the kinks in doing this well and the current framework wars that are being fought right now shake out winners and defacto standards emerge.

What about skillsets?  Too many people who prattle on about JavaScript and Python fail to consider that.  Companies need to hire people.  The number of skilled people determines how hard and how expensive that task is going to be.  Java skills are easier to find.  Paradoxically, they are also harder to find because the demand for skilled Java developers is so high that it is hard to find them because they don't move around much!

Java has had a long time to figure out what works well in a modern web development and service development context.  Python has a couple of well-known options like Django or TurboGears. 

JavaScript is all over the map right now playing the "let's reinvent Java because it is cool to do so" game.  JavaScript was never meant to be a back-end language and adapting it to that role is going to take time.  Hell, .NET developers are have been seeing the "new" MVC framework from Microsoft in the past couple years.  Java web developers are rolling on the floor howling with laughter at that one!  We were doing that 15 years ago and have used that time to refine what works and what doesn't!  Microsoft and the "modern" languages will be playing catch-up for sometime.

Managing large Java codebases is well known at this point.  It inherited that from its C ancestry.  Source control, build and deployment pipelines and most development methodologies like Agile have their roots in the Java space.

Legacy?  I sneer at that.  Give me a couple of good Java developers and I can probably wipe the floor with anyone using Python or JavaScript to roll out an idea and do it in the same amount of time and richness of capability.  With the advantage than when the idea needs to grow, I know my enterprise-grade solution will be able to scale because I'll have engineered it that way applying years of long experience.  Because I won't be reinventing the wheel when I crack out my JDBC frameworks, NoSQL frameworks, JSF2, Primefaces, Web Services components and the like.  You'll still be writing orchestration code or a front-end widget while I'm negotiating with my customers on what text their labels should have, hard work long behind me.

And I say this as some who is fluent in Python and JavaScript and use them in production systems.  And believe it or not, despite Java's strong typing, it is actually as dynamic in its behavior as Python or JavaScript are.  Java Reflection is the core of virtually every modern Java framework and we've been doing runtime inspection, runtime dependency injection and dynamic typing and runtime type determination for well over a decade.  Almost every piece of Java code I write, especially in a web application, is more-or-less a dynamically typed solution (i.e. JavaBean properties and dependency injected classes).

Languages are a means to an end.  They do not exist solely to justify themselves.  They are tools.  You're writing business solutions, not programming solutions. This is the first great epiphany you must come to understand.

See Questions On Quora

Posted on 18 January 2015

Is there a key benefit of programming an Enterprise SaaS solution in Java rather than say RoR or Python or PHP? Which SaaS vendors use Java?

There are technical benefits to building SaaS applications with Java. However, there are also costs; I would posit that building the system will initially have a higher cost in Java, but by the time that a sizable system is partially complete, Java's higher cost of entry will have more than paid for itself. (For reference, I am thinking for costs and benefits that I have seen first-hand in products that I manage development for, some built in Java and some in Python.) For smaller systems, I don't believe that Java's advantages will be as pronounced, and for the simplest of systems, Java is likely to be overkill.

Example SaaS built in Java include most of Oracle's SaaS offerings, CRM and Cloud Computing To Grow Your Business -, and many others.

FWIW - Often, the best choice of language etc. is the one that a company already knows and is comfortable with. Skill and well honed processes often trump minor technical advantages like those seen between languages.

For      the sake of full disclosure, I work at Oracle. The opinions and      views    expressed in this post are my own, and do not necessarily      reflect the    opinions or views of my employer.

See Questions On Quora

Posted on 13 December 2014

As a starting Python programmer I see a lot of praise for the Python language (and so far I can only agree). Isn't there anything bad to say about it? What is a real con?

Python s fantastic in many ways.  It's very clean in many ways, and the huge number of modules make it a snap to do electrical engineering, Fourier transforms, data plotting, reading/writing excel spreadsheets, doing 2D and 3D graphics, and much more, with a very few lines. 

But if there isn't a built-in feature or plug-in module and you have to write a complex and explicit loop to do something, it can be a bit slow.  What I do is google "How in Python can I swap rows and columns" and someone will very often have an answer of a built-in that will do the trick very quickly.

As an example of a success then a failure, I needed to parse a huge 33 gigabyte text data file and collate the data.   It only took about 60 lines of Python to do all the work.  However it took many minutes to run, and it eventually used all 4 gigabytes of memory and hung.

I had to rewrite the code in Delphi, and that program was more like 600 lines, but it ran about 10 times faster and used about 1/4 the memory.

So Python is very good in many ways, it's just not a solution for every problem.

See Questions On Quora

Posted on 29 October 2014

What is the best neural network library for Python?

  • The best "all purpose" machine learning library is probably scikit-learn. It implements many state of the art algorithms (all those you mention, for a start), its is very easy to use and reasonably efficient. The problem is that it is not very easy to tweak; the high-level documentation is good but the lower level stuff is not so apparent. It is an excellent tool if you have a dataset and want to test some various "off the shelf" algorithms on it, but it is not so useful as a basis for research.
  • If you want to explore specifically neural networks and want to build them "by hand" and experiment unusual stuff with them (different activation functions, recurrencies, etc.), then PyBrain is a good choice. You can build your network layer by layer with the components you want and manipulate them, all very easily. The limitations is that it only does neural networks, and also I find it quite slow.
  • I never used Fast Artificial Neural Network Library (FANN) but it is quite widely used; it is a C library with Python bindings and is designed to be fast.
  • It is not really a machine learning library but I want to mention Theano. It is actually a powerful symbolic computing library coupled with a C code generator for numerical evaluation. It is not easy to use, but it is extremely flexible and powerful and runs dead fast (you can even use CUDA, and it is completely transparent).
  • You also have Brian, which is a spiking neural network simulator. It is designed for computational neuroscience more than machine learning and is much closer to the biology than formal neural networks or mid-level firing rate models. It lets you describe the individual behaviour of neurons as a set of equations, and generates C code to speed up the execution (work on a GPU backend is in progress).

See Questions On Quora

Posted on 9 September 2014

Will Python suffer the same fate as Perl?

Not yet.

I think it turns out that Python 3 was a bad move strategically. But it's not the disaster that Perl 6 was because it noticably "exists". Whereas Perl 6 was vapourware for a long time. And Python 2.7 and 3.x continue to develop similar libraries in parallel.

 Worse still for Perl 6. Its first implementation was written in Haskell, which got Perl programmers thinking about Haskell. After which there were fewer Perl programmers.

So I don't think that Python programmers are going to fall out through the gap between 2.x and 3.x.

Still, it's a regrettable confusion. I suspect Python will continue with people recognising that it comes in two different "dialects" much as people accepted that there were different dialects of BASIC. And eventually one will just quietly die.

See Questions On Quora

Posted on 14 June 2014

If I had to choose between learning Java and Python, what should I choose to learn first?

The fact is, you may have to learn both in the end if you are determined to pursue a career in the IT field, so the order of learning is what matters here.

I think Python is more friendly to novices, and this is why it is sometimes called 'executable pseudo code'.

For software engineering, Java is more widely used, as for larger applications, a compiled language is way efficient than an interpreted language such as Python.

For doing data science, Python is more powerful with its libraries such as numpy, scipy, sklearn and so on, although Java also has some awesome packages.

Hope this helps.

See Questions On Quora

Posted on 13 April 2014

Why are banks like JP Morgan and Bank of America Merrill Lynch using Python to replace historic legacy systems built in Java/C++?

They aren't.

People use C++ as a LEGO brick and then python as a glue language to paste C++ components together.  Python is very useful for this because it interfaces with C++ nicely through things like boost::python.  Also you have something like a C++ computational engine call pieces of python code for something that you want configurable.

No one is replacing java and c++ with python.  The systems that are being replaced are ad-hoc older systems, including one that was built on top of Excel plugins.

See Questions On Quora

Posted on 13 April 2014

Is Codecademy the best source to learn programming for a beginner now?

The first time I heard about Codecademy was when Mike Arrington wrote a boldly titled blog post called: Codecademy Looks Like The Future Of Learning To Me. Now that's it been a couple years and the hype has settled down, I think it's worth revisiting whether that claim panned out or not.

What Codecademy Does Well

As the founder of another technology education company, I've always been incredibly jealous of Codecademy's landing page. From the moment you visit their home page, they already have you engaged and hooked into this gamified learning environment with short lessons and instant feedback. It's a great product and a really fun way to start learning the fundamentals of programming without having to go through the agony of installing a programming environment or reading some dry book.

What Codecademy Does Not Do Well

With Codecademy, you can learn syntax and basic programming concepts like objects, conditionals, and loops. That's only a fraction of what you need to know to do anything useful with programming though. I would break it down like this:

  • 5% Setting Up and Maintaining a Developer Environment
  • 20% Programming Syntax / Basic Concepts (Codecademy)
  • 50% Building Real Apps Using Frameworks, Libraries, and Design Patterns
  • 25% Meta Skills (e.g. knowing how to Google for things, use StackOverflow, being savvy about the web development industry)

The numbers are arbitrary, I'm just trying to weight each area relative to each other. My point is that with Codecademy you get a surface level view of programming but you won't come out of it with the ability to actually build anything, which kind of misses the point of programming in my opinion.


Overall, I think Codecademy is a great way to get an introduction to programming if you're starting from 0 and don't know what an "if statement" is. It is probably the most effective execution of gamification for educational purposes, but it's not as game changing as we all hoped it would be because the limitations it uses to make it seamless to start learning to code are the very limitations that will prevent you from building real applications.

Start with Codecademy, but as soon as you can you should try to graduate to something that actually teaches you how to build and deploy real applications.

See Questions On Quora

Posted on 11 April 2014

What are the advantages of using Python for building a website over using other languages like Perl, Java, ASP and Ruby on Rails?

Unlike Perl, Python is extremely clean and easy to read, encouraging good structure. As a result, Python code is easy to maintain, even by developers who were not involved with writing the original code.

Unlike Java, Python is much more concise, expressive and to-the-point. This makes it considerably faster to develop good quality software.

ASP and RubyOnRails are NOT languages in their own right. They are web development frameworks, and as such should not be compared directly with Python, but instead with a Python-based web framework like Django.

Unlike ASP, Django is not tied to any Microsoft operating system, platform, or technology - it is a much more open framework, with fantastic documentation, easy to learn and supported by a great community.

The only thing left to compare is RubyOnRails vs. Django. Here, the differences are much finer, because the two frameworks are very similar and have very similar strengths. There are plenty of articles on the Internet comparing the two, so I will not delve into that analysis here.

See Questions On Quora

Posted on 28 January 2014

What is the difference between Scala and Python?


I'm not an expert, but I'll share my experiences using them.  These lists combine both bad and good things, some may be both.


  • Has nice pattern-matching syntax. The NLP guys like this.
  • Forces you to start thinking like a software developer rather than a scripter
  • Compilation speed is irritatingly slow.
  • Gets you into transition from mutable to immutable data structures.
  • Is really easy to make it hard to read. It's both great and terrible that you can just string together so many functions.
  • The sheer number of data structures is staggering with a highly developed hierarchy. This makes it hard for newcomers I think.
  • Some people like Scala's Option[] as a fix for null
  • Statically typed. I like this.
  • Debugging can be hellish, obscure.
  • It's weird that people can just put spaces where I would use a . to conjoin functions. This would bother me in a team setting.
  • Not truly functional. It has functional aspects, but you can program in python for a lifetime without ever using them. Really, there are more idiomatic ways to accomplish some of the things. List comprehension versus filtering, for example. Scala's syntax for lambdas is just better.
  • Arguably easier to read.
  • Harder to transition to thinking like a software developer.
  • Larger community
  • For me at least, it's still faster and more enjoyable to develop in.


More trivially, I couldn't find a good plug-in to code in Scala in Sublime. I was forced to use Eclipse, which was a little disappointing. Scala worksheets were a nice surprise though.

See Questions On Quora

Posted on 12 December 2013

What are some "practice problems" that everyone should work on in-order to get better at programming (in any programming language)?

Some great resources have already been mentioned (I visit Project Euler periodically, myself), but here's a gem no one seems to be aware of:
Timus Online Judge
This is an "archive of programming problems with automatic judging system". For any given problem, you submit your code, and the system compiles and runs it against a suite of example and edge cases. You can solve Project Euler problems by a fluke, with unresolved edge cases, or brute-force; not so with Timus Online Judge problems.

See Questions On Quora

Posted on 26 July 2013

What are some "practice problems" that everyone should work on in-order to get better at programming (in any programming language)?

I don't think there are any that will be suitable for "everyone." It's going to depend largely on what you've done before, and perhaps also what you aim to do next.

Linked lists: In the first two or three C/C++ programs that I wrote on my own, I wrote my own linked-list classes. Not because good ones couldn't be found elsewhere, just because I wanted to try it. It took a couple iterations (pun intended) before I was satisfied that I had done it right, and I learned a lot in the process.

When you have a good singly-linked implementation, make a doubly-linked list.

It helps immensely if you have an app that needs a list. It's one thing to write one to pass a few unit tests - it's another to write one that meets the needs of an application.

State machines: In school, I had an assignment once to write something that would solve equations like:

X=(1+2)*(3 * (4 + 5 * 6)) / 7

That was kinda fun. We were studying grammars and state machines at the time, and this exercise was a fun way to put those ideas together.

Network protocols: Write something that can retrieve web pages via HTTP. You don't have to display them - just save them to disk. For bonus points, save the inline images, too. For more bonus points, write something that downloads entire web sites - and don't let it run unattended, or you'll embarrass yourself!

Then write an HTTP server, and test it with two or three browsers, and your own HTTP client.

If that was fun, try again with SMTP....  Write something that can send mail via SMTP. Test it against your ISP's SMTP server. When you get that working, write something that can receive messages via SMTP. Send mail to it from a few different pieces of software, including your own.

See Questions On Quora

Posted on 26 July 2013

Where can I find implementations of standard data structures and algorithms in Python?

A good place to start might be in the core Python library itself. The raw dictobject.c source (Python dictionary/hashtable implementation) is here:

The list implementation is here:

aaaand you can probably find the rest of the core Python data structures' implementations yourself:

There are also some textbooks you can check out if you Google a bit. This one, for example, seems to optimize for learning/readability over speed or efficiency, which might make a good starting point:

Welcome to Problem Solving with Algorithms and Data Structures

See Questions On Quora

Posted on 8 July 2013

As a Python developer, should someone apply at Facebook or not?

When I applied for an internship with Facebook, they told me I could use any language I wanted when solving the coding interview questions. (Although they warned me that I might run out of time if I picked Java, since it tends to be quite verbose.)

Every Facebook engineer I met was very smart and an excellent programmer, quite capable of picking up any language if necessary, or maybe just for fun. The interns came from various backgrounds. Some had worked almost exclusively with C++; some were quite proficient with JavaScript, some were fascinated by Haskell, and some extolled the virtues of LISP. As far as I could tell, most people had more trouble with Git than with the programming languages their teams used (typically PHP, or, rather, Facebook-flavoured PHP.).

Does this sound like you? Apply! It's am amazing place to work. You won't regret it.

See Questions On Quora

Posted on 3 May 2013

How fast is Python 3.x compared to 2.7?

On my Ubuntu VM running inside OSX, python 3.2.3 is benchmarking slightly slower than 2.7.3:

$ python2.7 -c "from test import pystone; pystone.main()"
Pystone(1.1) time for 50000 passes = 0.35
This machine benchmarks at 142857 pystones/second

$ python3.2 -c "from test import pystone; pystone.main()"
Pystone(1.1) time for 50000 passes = 0.42
This machine benchmarks at 119048 pystones/second

Several iterations of those tests returned similar results.

See Questions On Quora

Posted on 28 September 2012

Which is easier to learn: Python or Ruby?

Josh Susser is right that Ruby's object model is da bomb and Mattias Petter Johansson has the best analogy (viz. legos vs. clay). However, I think a lot of the answers focus on an absolute beginner, which you're not. Anyone who's tackled C and PHP has basic concepts and has likely abstracted some patterns from the code they've seen. If that's, true ... Learn Ruby.

As someone else pointed out[1], there's a lot of easy ways to get started. I'll recommend my favorite, which is:

  1. Buy Programming Ruby, aka The Pickaxe Book[2], and Agile Web Development With Rails[3]. Buy the electronic editions direct from the publisher; they continuously update them until the next major edition.
  2. Skim pages 24-231 in the Pickaxe Book with an irb session open. This will help you map the basic concepts from C and PHP. Don't try to read it all, just soak it in and tinker with some of it interactively in irb.
  3. Do the tutorial in AWDWR (Part II: Building an Application). This will walk you through making a simple Rails app, touching on all the significant features of Rails.
  4. Fix a bug in two open source projects: one gem, one Rails app. This will start to clarify the division between the two, and demystify gems a bit.
  5. Fix a bug in the Rails framework. This will initiate you into the mysteries of the framework you've been using (and its "magic").

Once you've done that, I suspect you'll be good to go.

Good luck!


See Questions On Quora

Posted on 22 January 2012

Do Python programmers have a tendency to write their own software instead of contributing? Why?

I think you'll find that PROGRAMMERS have a tendency to develop their own thing rather than contributing to an existing project. It's even got its own TLA: NIH (Not Invented Here).

It's not always a bad thing. When Dave Winer expressed dismay at Douglas Crockford for inventing/discovering JSON when XML and XML-RPC already existed, Douglas responded:

"The good thing about reinventing the wheel is that you can get a round one."

See Questions On Quora

Posted on 22 January 2012

What's the quickest way for a non-programmer to learn Python?

I initially wrote this up as an email to my sister, who has no programming experience but wants to learn Python for use in her biology research. I'm posting it here in the hopes others will find it useful. This is intended for people who want to get started quickly with Python without getting bogged down in details.

When I said that Python is easy to learn, I was perhaps overstating it a bit. If you already know how to program, Python is easy to learn. However, learning to program tends to be kind of hard. Still, it's much easier to learn Python without any prior programming experience than it is to learn most other languages, so starting with Python is a good idea.

The biggest hurdle to getting started with Python is just figuring out how to get your code written and running. Once you're able to write code and run it, everything's going to get much easier and more rewarding, but it's hard to get past that first hurdle. I'm gonna guide you through setting up what I think is the most newbie-friendly development environment, and then point you to a tutorial whose methodology I like.

Before we set up a way to write your code, there's a few things you should know. There are two basic ways you'll be writing and running Python code...

Python scripts
A basic Python program is called a "script". It's really just a text file which typically is named with the .py extension. You could write these in any text-editor, and some people do use really basic text editors to write code. Once you've written your code, you'll execute it by  running a Python "interpreter" on the script. The interpreter is a program which goes over your Python code and executes it line-by-line.

Python interactive interpreter/shell
Sometimes, you'll just want to test out a line or two of Python code to see if it does what you want. In this case, making a new text file and running it through the interpreter is a bit of a pain. The interactive interpreter (aka the Python "shell") lets you type a line of Python and see the result right away. For example, look at this copy-and-paste. (Lines that start with >>> are user input):

[code python]
>>> print "Hello, world!"
Hello, world!
>>> 1 + 2 * 3

Immediately below the input line, you see the output of running that line. This is very handy for testing individual lines of code.

Setting up your computer
Mac OSX comes with some basic text editors and a Python interpreter pre-installed. So, in theory, you have all you need to start writing code. However, the text editors in OSX are really basic and not very user-friendly, and the Python interpreter has to be run from the command-line. For experienced programmers who use the command-line frequently, this isn't a problem, but I think it's not the easiest way to get started if you're new to programming. There is, however, an alternative: An "Integrated Development Environment", or IDE.

An IDE is essentially a fancy text-editor with tools for running your code and the interactive interpreter built-in. Programmers have holy-wars about whether text-editors or IDEs are better for productivity, but I favor having an IDE. I also think it's easier to learn to program with one. The most user-friendly Python IDE I've encountered is Komodo IDE, which is unfortunately not free. There's a free trial, and there are ways of obtaining a license file when the trial runs out.

Komodo IDE
Download and install the free trial from here:

Launch the IDE and take a look. There are a lot of different panes and buttons, most of which you won't use. The important parts are these:

  • The text editor. This is the primary view in the app, and it's where you'll write your code. There are tabs for each file you have open, kind of like in a web browser.
  • The interactive shell. This isn't visible by default, so go to the main menu > Tools > Interactive Shell > Start/Find/Hide Default Interactive Shell (Python). Selecting this should make it appear in the bottom pane of the app. Try typing a command like print "Hello, World!" and see what it does when you hit enter. If you have trouble finding this option in the main menu, remember that the "Help" menu in any OSX app will show you the location of any menu option if you type it into the search box.
  • The Debug output. This warrants some explanation.

When you run a Python script you've written, it will often not work correctly on the first try. It can be helpful to pause the script's execution partway through, step through it line by line, examine the contents of variables, et cetera. In order to be able to dissect a running Python script like this, you use a special mode in the interpreter called "debugging" mode. Since this mode is so commonly desired, it's the default way to run Python scripts in Komodo IDE.

For your purposes, to "debug" a script and to "run" a script mean the same thing. You won't be using the cool features of the debugger, but you'll still hit the "debug" button to run your scripts. Just thought I'd preemptively clear up that terminology issue. When you hit the "Start or continue debugging" button (which looks like a play button on a remote), it'll run the Python file you have open and it will open a pane called "Debug Output" at the bottom of the app which will display your program's output.

One last thing before moving on -- in the main menu bar, go to Komodo > Preferences and select "Debugger" in the pane on the left. This will present various preferences for the debugger. Check the box that says "Skip debugging options dialog (use Ctrl key to override)". This will prevent an annoying dialog box from popping up every time you run your scripts.

Your first script
Time to write your very first Python script. If you can do this and everything works, you've gotten past the biggest hurdle to new programmers.

In Finder, create a folder in "Documents" called "Python" where you'll keep your scripts. Once you've done that, it's time to make your first script. In Komodo, go to "File > New File from Template…". Choose the "Python" template, and click on "Local…" and browse to the folder you created for your scripts. Name the file something like "".

This should open up a new tab in the text editor to a newly created file named "" which will be empty but for a single, commented line at the top. You can leave that line in or delete it, it does not matter. Add the following line to your script:

[code python]
print "Hello, world!"

Now let's see if it works. The top of the Komodo window will have a bunch of buttons -- look for the one that looks like a "Play" button on a remote. This is the "Start or continue debugging" button. Click on it to run your script. If everything goes well, it should open the "Debug output" pane I mentioned before. The output section of this pane should show the text "Hello, world!".

Learning Python
Okay, the hard part is over. Really. Getting your code to run is a big obstacle to getting started as a programmer, and if you've gotten this far, it gets easier from here. Now all you have to do is learn the language.

Your choice of tutorial will depend very strongly on how in-depth you want to learn Python. It's an incredibly powerful and flexible language, and you'd need years of programming experience to understand all of its finer points. A lot of the resources out there are aimed at people looking to study Computer Science with the intention of becoming professional programmers someday. That's probably more in-depth than you're interested in.

Unfortunately, I've not found any single tutorial that I think is perfect for a beginner. For getting started quickly without getting bogged down in details, I think "Instant Hacking" is a pretty good tutorial:

By the time you finish with this tutorial, you should be able to write basic functions which take some kind of input, perform basic operations (like arithmetic) on the input, and return a result. This is a good place to start. Once you get through that, the next topic to study is "classes" and "object-oriented programming", for which there are many tutorials you can find online.

See Questions On Quora

Posted on 11 January 2012

How long should it take to learn how to program?

How long to learn "how to program" - all your life.

I've been coding professionally for 10+ years, and I'm learning something new every week. When a week passes and I haven't, I'm sad. When I get to learn a lot of new things in a week, I'm thrilled. And I know there's always a ton more to learn ... always (see

Now, how long does it take to master "a programming language"? Suppose you focus on one domain, such as web programming, and one language such as python. I believe that within about one year of doing actual 9-hours-a-day work, you can "master" a language - that is, know all the major idioms and data structures, have at least one IDE that makes you feel super comfortable, know a good many important 3rd party libraries, and know how to investigate new problems.

You won't know all the hidden features, internal compiler details, and esoteric libraries in a year ... that simply takes time. But the good news this gets much easier after your second or third programming language. You start seeing patterns, and even though it always takes time to get productive in a new language, it really gets down to only a few months of re-wiring some brain patterns in new ways.

See Questions On Quora

Posted on 2 December 2011

How can I learn to write idiomatic Python?

No, no, no. You start by reading Python. Python source. As in, the code.
  • Not a book. When I was in China, one of my friends showed me an English proficiency test she had to take to get qual'd. It was hard as balls; even I had no idea what some of the answers to the questions were, and I'm a native speaker. She did know the answers, though. All of them. And the result is that she knew a lot about English. In spite of this though she could not speak it.

    Programming is more or less the same. It's a community event: you are operating in a system with other people, and the shorthand, the hacks, the abbreviations, are all part of this system. If you want to learn these things, you need to be a part of this system. You need to read Python.
  • Not PEPs. When I learned Chinese, I picked up a book called Making Out In Chinese. It was great, full of idioms. It explained where they came from, and why they were idioms. But it did not teach me idiomatic Chinese. It just taught me Chinese idioms. This is a subtle but crucial difference: imagine someone who clearly does not know English at all walks up to you and says (in a heavy accent), "What's up?" This is not the same thing as when I say this to my friends. This person has just used an English idiom, but they are not speaking English idiomatically.

    In the real world, idiomatic English (just like idiomatic Python) requires good judgement and understanding of context[1]. I'd say this is actually more important in programming since one big component of these systems is that they need to be correct. And at the end of the day, this is something that you can't really get without being a part of the dialogue. You need to read Python.

Caveat: This is not to say that these aren't great resources. For learning about Python. Learning about Python will help you to be a better programmer, and I say this from experience. But it will only get you so far. So roll up your sleeves and get out there.

If you're looking for projects to look at, I like the source of Brubeck framework[2] and Mercurial[3]. Per Shashwat Anand's (correct) suggestion, standard library stuff like heapq and shutil are also worth looking into.

I'M NEW HERE. Please leave me any criticisms that might be helpful as I slowly learn to be a better writer!

[1] Also, it's easy to make mistakes when judging idioms. Do you know the best way to create a 2-D List of
's? A quick perusal of the internet might lead you to believe it's
, but this is very very wrong, and in order to understand why, you need to have spent time with it.

See Questions On Quora

Posted on 19 August 2011

Should I learn Python or Ruby?

The two languages are very similar and have very similar web frameworks (Rails & Django). Rails seems to have a *slightly* bigger web-app footprint than Django, so the case could be made that learning Ruby might open up more opportunities. On the other hand Python seems to be more general-purpose and has more support, libraries and general momentum behind non-web contexts. As a general technical skill, it's hard to argue that adding Python to your toolkit won't look great on a resume as well.

Ruby/Rails clearly has more publishing behind it, and you're more likely to find books at B&N/Amazon to onramp you. On the other hand Python is tremendously well-documented online and has a very active and enthusiastic community. But then, this isn't exactly a weakness of Rails either -- the community is vibrant and very creative, as evidenced by the sheer volume of screencasts, daily audio, etc: Ruby5, RougeRuby, PeepCode, Railscasts, PragProg, on and on.

I come from a Rails background, but with a longtime fascination with Python and a deep appreciation for the Py community, and honestly I think it's a toss-up as far as features, support and general coding fun. My Django colleagues say the same kinds of things I say about Rails and Ruby: it's fun to code in, gets out of my way, makes web application development a real delight, etc.

There seems to be some personality differences between the communities that you should take into account, and think about where your proclivities lie as a coder. The Python community seems to prefer explicit, readable apis at the cost of a slightly more verbose syntax (Ruby's 'do/end' notwithstanding). The RoR community favors more 'magic' in their apis, reducing LOC at the expense of some readability (I mean, if you can tell me what 'composed_of' *really* means on the first look, my hat's off to you). I happen to appreciate the productivity and conciseness of the Rails idiom, and I'm willing to accept that there's a lot more up-front memorization I have to do to pay for it. But it's this kind of thing that seems to drive some of my Python-centric brethren up the wall.

If you don't have an immediate context that one or the other would apply (i.e., some existing application at work), then I'd say spend a bit of time in each community and see which one you start gravitating towards. You can't really lose either way, but you're more likely to find where your personality fits better once you get to know the very distinct flavor of each community.

See Questions On Quora

Posted on 23 July 2011

Why don't some schools teach languages/frameworks like Python or Ruby on Rails? Should they?

Frameworks are ephemeral. Today, it is Ruby on Rails. Tomorrow, it may be Python with wings. Day after, it could be Clojure on legs.  So,  it kind of makes no sense for universities, who are supposed to prepare their students for careers (and not projects) to teach what's hot right now. What is important to pick up in college is to learn how to think and then turn it into code. Programming languages are tools to encode your thoughts in one way or the other. It is sad that they are treated as the end in itself, while they are just the means to the end.

See Questions On Quora

Posted on 10 July 2011

What is the status of Unladen Swallow?

As of now there have been no commits to Unladen Swallow in months. The big problem with it is that Pypy, a much more ambitious project with more developers and more excitement around it, is now posting better CPU gains than Unladen Swallow is, which raises into question what's the point of contributing to Unladen Swallow when it's going to be replaced with Pypy in very short order anyway.

While the future is unclear, my money would be on Unladen Swallow being dead in the water at this point.

See Questions On Quora

Posted on 12 March 2011

Which is easier to learn: Python or Ruby?

I think Python's the easier language. I find the documentation richer, the community more helpful to new people, and the language itself simpler. Ruby has a somewhat Perl-esque tendency to allow things to be done in several different ways, and has some very loose syntax. Python has significantly more structure, which I personally found more elegant and easier to pick up without as many moments of "wait, what?" as I had with Ruby.

That said, Ruby has Rails, which is just better supported than Python's Django. If I were developing tools or scripts I'd choose Python, but if I was going to build a website I'd seriously consider biting the bullet and going with Ruby for its great ecosystem.

See Questions On Quora

Posted on 13 November 2010

What are some tips for a new Python developer coming from C++/Java?

Sure, I'll throw in a few:
  • Don't just "translate into Python" for the code you're writing.  Learn the truly Pythonic way to do things, and do that.  Read lots of Python code to understand what Pythonic means.
  • Learn and follow PEP8  Integrate PEP8 checking into your editor if possible.
  • Read the Zen of Python and really think about what these things mean.
  • Don't assume everything you were doing in C++/Java is really necessary.  public/private members and functions, pure virtual interfaces, and "every function must belong to a class" are all design patterns that can be reconsidered when programming Python
  • Use your common sense. As with any other language, there's lots of crazy things you can do in Python that a reasonable programmer won't really want to take advantage of. Learn what these things are and come up with your own style.
  • Don't rely on C++ extensions for everything. Don't use SWIG. Just write your code in Python. There are a few applications where C++ extensions are almost critical (numeric processing, encryption, compression, image processing, etc.) but otherwise, you just want to write pure Python.
  • Leverage as much open source code as you can. In general, whatever you can think of has probably already been written before.  Find it and use that one, or at the very least, read it and learn from it.

See Questions On Quora

Posted on 30 September 2010

What are the advantages of Python over Ruby?

The canonical response is to post the Zen of Python:

The Zen of Python, by Tim Peters

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!


From my personal experience:
  • Better support for scientific libraries I use in my day-to-day work: Ruby has no scipy/numpy, let alone the countless smaller modules.
  • Better readability and maintainability: this is very subjective, but I much prefer Python's syntax having used both.

These questions always come down to: Give both a good try, and pick whichever you like best. You can do pretty much everything in either language.

See Questions On Quora

Posted on 21 July 2010

What is the easiest way to find the longest common prefix or suffix of two sequences in Python?

I ended up doing this:
def longest_common_prefix(seq1, seq2):
    start = 0
    while start < min(len(seq1), len(seq2)):
        if seq1[start] != seq2[start]:
        start += 1

    return seq1[:start]

def longest_common_suffix(seq1, seq2):
    return longest_common_prefix(seq1[::-1], seq2[::-1])[::-1]

I'm curious if there's anything built in, though.

See Questions On Quora

Posted on 10 July 2010

Why doesn't Quora use a Python database ORM?

My limited experience with ORMs in the past has been that the problems they solve aren't big problems that are hard to get your head around or hard to code solutions for, and so the overhead of the abstraction makes them not worth it if you are doing anything out of the ordinary.

If there are performance concerns, you usually want to control and understand what SQL you are using, and then you have to peel back the abstraction, which is work.

For an application like Quora, most of the data doesn't involve complicated JOINs or anything, and so the code to retrieve it from the database and put it into a Python data structure is trivial.  Ex:
for row in query('SELECT from_user FROM user_follow WHERE to_user = %s', to_user):

Since Quora is realtime, we need to do some special things whenever data changes, and the ORMs I'm familiar with make that more complicated than it would be than just manually taking data from MySQL and putting into objects.

Also, if the amount of data you are storing gets large, you usually need to either use something other than MySQL (some sort of key/value store, etc.) or partition your databases, and my impression is that migrating to one of these solutions is easier if the way that your data is structured in the database and in cache is very clear.

ORMs seem to work pretty well for many people, and I think it could make sense if you aren't very comfortable with SQL, are doing pretty standard things with your application, and don't need to scale to a very large size.

See Questions On Quora

Posted on 10 June 2010

What are common uses of Python decorators?

Decorators are convenient for factoring out common prologue, epilogue, and/or exception-handling code in similar functions (much like context managers and the "with" statement), such as:
  • Acquiring and releasing locks (e.g. a "@with_lock(x)" decorator)
  • Entering a database transaction (and committing if successful, or rolling back upon encountering an unhandled exception)
  • Asserting pre- or post-conditions (e.g. "@returns(int)")
  • Parsing arguments or enforcing authentication (especially in web application servers like Pylons where there's a global request and/or cookies object that might accompany formal parameters to a function)
  • Instrumentation, timing or logging, e.g. tracing every time a function runs
They are also used as shorthand to define class methods (@classmethod) and static methods (@staticmethod) in Python classes.

See Questions On Quora

Posted on 19 January 2010

What is the purpose of the __hash__ method of Python objects?

One place it's used is if the object is a key in a dictionary (which is a hash table - see How are dictionaries implemented internally in Python?)

If you try to make a dictionary using an object without a __hash__ method as a key, you'll get a TypeError:

In [1]: {[]:0}
TypeError: unhashable type: 'list'

See Questions On Quora

Posted on 19 November 2009 search results

Everyone who encounters it seems to love Python. Everyone seems to bitch about languages like Java and C++. Why isn't Python more widely used in Enterprise and will it ever be?

I was reading this thread on /r/Programming about how Oracle has lost interest in Java. One of the comments says

Objective-C / Swift live on Apple island, C# lives on Microsoft island. That leaves going back to C++ or surrender oneself to the Python version schizophrenia (sounds most fun of all other options).

I started learning code with Python and I love it. I write it for fun. Now I'm having to learn Java for college and it sucks. There's so much more code to write to do simple things and you can make so many silly little syntax mistakes so easily that it makes it harder to actuallly write functioning code. A lot of people in my class are completely new to programming and they are so lost.

I understand that because of the JVM, Java is super duper portable and a lot of existing code is written in Java. Is that the only reason it continues to be used? Would a startup or a company building something from the ground up completly avoid Java? Is Java the only language we can use for Android dev?

C++ seems to be universally hated on with C# being the best alternative but leaving you tied to a MS plaform.

Then behind all of this there's Python. Python is a dream to read and write. Has a bunch of amazing libraries to do all kinds of cool shit. There's tools like Flask, Django, Kivy and others that allow you to use Python for WebDev and Mobile Dev.

Even if you look at this sub there are 111,085 readers. /r/Java has 46,788 readers and /r/cpp and /r/csharp have around 30k readers. If everyone loves Python so much why is it not being used more? What am I missing here?

EDIT: Too many responses to reply to but thanks everyone for your input. Some good points were made about how I'm srill very new to this and will see the benefit of Java's constraints when working with other devs. Also the fact that Python just cant compete for speed in some situations.

It seems to me that Python is an excellent tool to have on your utilitiy belt. Great for automating things and supplementing other tools (As well as being perfectly capable, most of the time, of building full size projects). However those other languages might not be that scary and have their own advantages over Python.

In my opinion though Python is an amazing educational tool. I think it could reasonable be introduced in Primary education without too much hassle while I wouldn;t say the same about Java.

submitted by looneymicheal to Python
[link] [298 comments]

Posted on 30 September 2015

I recently released "Intermediate Python", a free and open source Python book. After receiving a LOT of positive feedback and support it is in Beta stage now!

Hi guys! You might already know that I released a free and open source book on Intermediate Python. The name of the book itself is also intermediate Python. After my last post the book received a lot of patches and it is in a whole lot better shape now. It also received a LOT of positive response from the community. It remained on the front page of Hacker News and /r/Python. It is currently a trending project on GitHub under the Python tab. I am happy to say that it has entered beta stage now. This is the best time to take a look if you haven't already.

Moreover, if you want to add anything to the book or just want to polish it further then you are more than welcome to submit a Pull request on GitHub.

I just wanted to write a quick note that a lot of people asked me last time whether I accept donations. I wasn't accepting donations untill recently. I have uploaded the latest build of the book on Gumroad so if you feel like tipping me then you can buy the donation version of the book from Gumroad. It would mean a lot to me and would help me to continue writing free quality content.


submitted by yasoob_python to Python
[link] [22 comments]

Posted on 23 August 2015

I just released alpha version of "Intermediate Python", my first and free E-Book.

Hi guys! After a lot of hard-work and sheer determination I have mostly completed my book, "Intermediate Python". It will receive updates over time :)

It has a couple of issues related to grammar and technical info in it. I am working on ironing them out one by one.

I was a bit lazy so didn't upload it earlier but here it is now.

I have decided to distribute it for free! I wanted to give back to this awesome community so this is what I have to offer for now. I am sure that it would help those who really want to be helped. Best of luck!

Here are the links:

If you like this book then a simple tweet and a personal email <yasoob DOT khld AT gmail DOT com> would mean a lot to me!

P.S: The book is open-source so if you find typo or technical error or just want to expand it's contents with your own knowledge then just send over a pull request :) Moreover, if you want to give me any tip then kindly pm me your email and I would let you know once I setup a tip-collection system.

Note: This is not related with that paid "intermediate Python" book in any way. I became aware of it today. I had been using this name internally for a couple of months. If the author of paid "Intermediate Python" has any issue with this I would be more than happy to change the name of my book because he definitely beated me to the finish line. :)


Hey guys! All those of you who are going to use this book can really help me and motivate me by letting me know how this book supplements your day to day learning and if you are a Teacher, Assistant Professor or something of that sort then kindly let me know if you would be willing to offer this book to your students or not. :)

You already have my email address or if you want to tweet about it then you can do so at @yasoobkhalid.

Moreover, I really can't thank this community enough. This community has helped me a LOT over the years. If you see my Reddit profile then you can easily guess that this is the only community (/r/python) where I spend most of my time.


You guys can donate me if you want to by buying the donation version of Intermediate Python from @gumroad :)

It is only for $10 but if you want to pay less then kindly let me know (pm) and I can give you a custom link.


submitted by yasoob_python to Python
[link] [78 comments]

Posted on 17 August 2015

Coming from a C background, I LOVE PYTHON!

I dont know how others new to python feel , but coming from a C (bit of java and cpp as well) systems background , I totally love python! I just love how easy it is to build useful stuff , in the last week I have worked on simple but somewhat useful things like : 1) getting weather for your location 2) automating file creations from db data , handling error cases better (as compared to bash the code was much more cleaner ) 3) currently working on scraping an ecommerce website for checking on price drops for wishlisted products . Love the power the libraries like pickle,soup, smtp etc provide !

I would have taken a considerable amount of time and coding to build any basic useful thing with C , and would cringe everytime I need to implement a map,list etc ! BTW I do know the usecases of C are very different but the freedom python provides just leaves me wide eyed!

Only thing is I know very little of how and why python works the way it works . Am currently going thru more usage based tutorials and googling the rest , but unlike C I have a very slight discomfort of the lvl of abstraction .

Any good resources for taking my knowledge to the next level and some good projects to take up next?

submitted by shashank88 to Python
[link] [184 comments]

Posted on 19 May 2015

Experienced Python Users: what's the most recent new thing you learned about the language?

I ask this because I just learned something new that I feel like I should have known for a long time... if you define a class with a __len__() and a __getitem__() method, it automatically becomes iterable! e.g.

class Foo(object): def __len__(self): return 10 def __getitem__(self, i): if i > len(self): raise IndexError return i for i in Foo(): print(i) 

What's the most recent new Python feature you have learned?

submitted by jakevdp to Python
[link] [305 comments]

Posted on 17 April 2015

When do you *NOT* use python?

Hi everyone,

We're all python fans here, and to be fair I may use it a bit more than I should. I'd like to hear other people's thoughts on which tasks they want to solve in a non-python language and which one they'd choose for that job.

Thanks in advance...

submitted by RealityShowAddict to Python
[link] [421 comments]

Posted on 16 February 2015 should stop steering web visitors away from v3 docs

$ curl --head HTTP/1.1 301 Moved Permanently Date: Fri, 06 Feb 2015 23:22:21 GMT Server: nginx Content-Type: text/html Location: 

This is another contributing factor to why v3 adoption is slow, and new users are confused. This configuration affects everything from StackOverflow links (how I first noticed it) to Google pagerank.

It's why Python3 docs don't often show up in search results. should default to v3. Or, at the very least, display a disambiguation page, a la Wikipedia.

submitted by caninestrychnine to Python
[link] [67 comments]

Posted on 6 February 2015

What do you *not* like using Python for?

Maybe sounds like a silly question, but here's the context: Been programming for ~10 years, professionally for the past 7. Matlab, C#, C++ (in decreasing order of proficiency). Per management, it looks like I'll now be getting into some Python for an upcoming project... which is cool, as with how prevalent Python seems to be, I've wanted to get my feet wet for a while.

Obviously all languages have their bounds... or at least things they do better than others. So - as I'm getting my feet wet here, does anything stand out as far as areas where Python is weak and there may be better alternatives?

submitted by therealjerseytom to Python
[link] [353 comments]

Posted on 18 October 2014

What are the top 10 built-in Python modules that a new Python programmer needs to know in detail?

I'm fairly new to Python but not to Programming. With the programming languages that I've learned in the past I always see a recurring pattern — some libraries (modules) are more often used than others.

It's like the Pareto Principle (80/20 rule), which states that 80 of the outputs (or source code) will come from 20 of the inputs (language constructs/libraries).

That being said, I would like to ask the skilled Python veterans here on what they think are the top 10 most used built-in modules in a typical Python program, which a beginner Python programmer like me would benefit to know in detail?


Thanks to all that have replied :)

I found a site where I can study most of the modules that you suggested:

(Python Module of the Week)



Of course, there is no substitute for the official documentation when it comes to detailed information:

Python 2.7.*:

Python 3.4.*:

submitted by ribbon_tornado to Python
[link] [135 comments]

Posted on 24 June 2014


Русскоязычная группа посвященная языку Python. [link]

Posted on 18 May 2014

Learning python earned me a 50% raise, and it's about to again.

(Sorry for the throwaway, but I wanted to be able to answer questions honestly without any hesitation.)

I've been in IT since I was 17 in 1999. I started off at a help desk, and worked my way up to a Systems Administrator where I was making 60k USD/yr. (I currently have only an associates degree with no plans to go back to school.) I was primarily a Windows domain/ network admin, with a few *nix boxes spread throughout. I had known windows batch scripting, and way back in the day had programmed in BASIC before the world was.

I had tossed around the idea of learning a programming language before, but when asked I'd often say "Developers' brains just work differently than mine. I'm not a coder." Programming seemed so abstract and I couldn't really wrap my head around it. I finally decided though, to try something.

It was 2010 and I had heard a lot of Ruby on Rails and thought that Ruby would be a great language to learn. I ran through the tutorial of making a polls app at least 5 times, but I just couldn't wrap my head around it. So I gave up.

One year later I heard about python. Despite all the negative talk about python while googling for "python vs ruby vs php vs ..." (GIL, speed, whitespace, duck typing, (not that I knew what ANY of that meant anyway)) I decided that I really wanted to give it a shot. I started out with codeacademy to get my feet wet, I'd tinker with idle while my wife and I would watch netflix after the kids went to bed. Then I started dreaming in code.

Have you ever had "work dreams"? The kind you have for about 2 weeks after starting a new job that's really hard? That was python for me. Being primarily in a Windows environment it was hard to find anything for python to do initially at work. My boss didn't program, and really didn't see the value in it. Then one day I found myself needing to compare a list of files. I needed to find all the files that were in one column but not in the other. I had them in excel and after working through a formula I had my answer, but I hated it. All I wanted to do was write something like--

select name from column1 where name not in (select name from column2); 

Enter python and sqlite. It probably took me about 3 hours to figure it out, but I imported a csv into a sqlite table in python so I could query it. BAM! I was hooked from then on.

Every night I would tinker, read, and play. I found tons of things to automate at work, making my time so much more effective. I loved it. I became a python evangelist. I'd like to say that my boss was impressed, but really he never came around, and it frustrated me. Fast forward a year.

I had heard about the DevOps movement and though I didn't understand it completely at the time I thought that being a Developer and Systems Admin mutant sounded like a lot of fun, and something I could really be good at.

After having a rough time with my boss one day I decided to check the local classifieds. I saw an ad for a DevOps Admin. Basically this guy needed to know hardware, networking, provisioning, something called puppet, and one of three scripting languages- ruby, bash, or python.

I looked at puppet, and after having learned about booleans and strings and syntax from python, picking it up wasn't a problem. I got hired on the spot for $90k USD. A clean 50% raise. I use python every single day. I write scripts to check if databases back up properly, if services are up, if all 1000 of my physical servers are getting their updates, to provision RAIDs, you name it. I integrate what I write into puppet, fabric, and a host of other tools that I've learned along the way.

After doing that for a little over a year now, I'm about to hire 2 guys under me as we expand and I'm moving up to $120k USD. I'm learning django for fun and am just starting into machine learning. I check out /r/python every day, you guys have been so helpful to me along my way. And if I can learn python, anybody can!!!

TL;DR I learned python in a year and got a 50% raise. 1 year later I got another 25% raise, all from python!

edit: percentages, oh math...

submitted by self_made_sysad to Python
[link] [142 comments]

Posted on 6 May 2014

What is the best part of python you wish people knew about?

I just quit my job at a major software company to be with a startup in downtown seattle and it looks like our stack is Python based. I'm new to Python but I want to learn fast; So please, let me what you like the most (or hate the most?) about python, other python developers code, etc so I can take all the good and not use the bad as I learn this new language.

Who knows, maybe you will need to maintain my code someday, so you could only be helping yourself!

Thanks in advance!

submitted by honestduane to Python
[link] [226 comments]

Posted on 16 December 2013

Eric Idle here. I've brought John Cleese, Terry Gilliam, Terry Jones and Michael Palin with me. We are Monty Python. AUA.

Hello everybody. I had so much fun last November doing my previous reddit AMA that I decided to return. I'm sure you've seen the exciting news, but here we are to confirm it, officially: Monty Python is reunited. Today is the big day and as you can imagine it's a bit of a circus round here, but we'll be on reddit from 9am for ninety minutes or so to take your questions. We'll be alternating who's answering, but everyone will be here!:

  • J0hnCleese
  • Terry_Gilliam
  • TerryJonesHere
  • _MichaelPalin


Update: We're running a little late but will be with you 10-15 minutes!

Update 2: The url for tickets - - available Monday

Update 3: Thank you for all the questions. We tried to answer as many as we could. Thanks everyone!

submitted by ericidle to IAmA
[link] [7716 comments]

Posted on 21 November 2013

What you do not like in Python?

I'm a big fun of Python! I use it every day! But there are things which are annoying, strange and so forth in Python (you really don't like it). If any, please, share your thoughts. For example:

  • built-in set type has method like symmetric_difference_update. I don't like so long methods in built-in types.
submitted by krasoffski to Python
[link] [891 comments]

Posted on 18 September 2013

Python interview questions

I'm about to go to my first Python interview and I'm compiling a list of all possible interview questions. Based on resources that I've found here, here and here I noted down the following common questions, what else should I add?


  • What are Python decorators and how would you use them?
  • How would you setup many projects where each one uses different versions of Python and third party libraries?
  • What is PEP8 and do you follow its guidelines when you're coding?
  • How are arguments passed – by reference of by value? (easy, but not that easy, I'm not sure if I can answer this clearly)
  • Do you know what list and dict comprehensions are? Can you give an example?
  • Show me three different ways of fetching every third item in the list
  • Do you know what is the difference between lists and tuples? Can you give me an example for their usage?
  • Do you know the difference between range and xrange?
  • Tell me a few differences between Python 2.x and 3.x?
  • The with statement and its usage.
  • How to avoid cyclical imports without having to resort to imports in functions?
  • what's wrong with import all?
  • Why is the GIL important? (This actually puzzles me, don't know the answer)
  • What are "special" methods (<foo>), how they work, etc
  • can you manipulate functions as first-class objects?
  • the difference between "class Foo" and "class Foo(object)"

tricky, smart ones

  • how to read a 8GB file in python?
  • what don't you like about Python?
  • can you convert ascii characters to an integer without using built in methods like string.atoi or int()? curious one

subjective ones

  • do you use tabs or spaces, which ones are better?

Ok, so should I add something else or is the list comprehensive?

submitted by dante9999 to Python
[link] [184 comments]

Posted on 19 August 2013

What is Python not a good language for?

I am moving from writing one-off code and scripts to developing tools which are going to be used by a larger group. I am having trouble deciding if Python is the right tool for the jobs.

For example I am responsible for process a 1gb text file into some numerical results. Python was the obvious choice for reading the text file but I am wondering if Python is fast enough for production code.

Edit: Thanks for the all responses. I will continue to learn and develop in Python.

submitted by Hopemonster to Python
[link] [229 comments]

Posted on 6 May 2013

Are there any things about Python that you do *not* like, or that you wish were done differently, or that you flat out think are wrong?

I lightheartedly joked in another thread that if the person had agreed with my point (that Python 3 seems very slightly harder to code in than Python 2.x - also a lighthearted, almost completely unfounded critique), that it would be the first time I'd ever seen any Python user online agree with any criticism of any part of the language. In this last bit I'm not really joking.

I had many newbie critiques a few years ago - 'self', the fact that you can't join a string list with myList.join(', '), something about slicing that I forget now, that it was confusing which things worked in-place, and which worked on a copy, etc. - and in a forum (not reddit) where I posted up my lengthy list (mostly to see what people thought of these things), I was met with a wall of responses, all strongly in favor of every last part of all of it, and even of things I hadn't mentioned. In 3 years I realize now I have never once seen anyone critique any part of the language and not be met with all manner of deep, philosophical justifications as to why that thing or those things must be that way.

It's the perfect language, I guess.

So my new question is just straight up: IS there anything about Python you don't like? I mean, it is moving to 3, and there are changes, so clearly 2.x had room for improvement, so let's hear it. Be prepared for a battle on all fronts from everyone else in here, though, whatever you say :) I'd love to hear from the real experts, the people who usually wield seemingly powerful reasoning and long strings of computer science words in their arguments.

This itself isn't a critique, nor even a jab, but just another attempt to learn more.

submitted by gfixler to Python
[link] [576 comments]

Posted on 16 November 2011

Python Educational

Subreddit for posting content, questions, and asking for general advice about learning Python programming language. [link]

Posted on 2 October 2009


news about the dynamic, interpreted, interactive, object-oriented, extensible programming language Python [link]

Posted on 24 January 2008