Python is a dynamic, high-level language. Its design focuses on clear syntax, an intuitive approach to object-oriented programming, and making the right way to do things obvious. Python supports modules, exceptions, had an extensive standard module library. Python can also be embedded in other ...

learn more… | top users | synonyms (1)

115
votes
9answers
23k views

Why do people hesitate to use Python 3?

Python 3 was released in December 2008. A lot of time has passed since then but still today many developers hesitate to use Python 3. Even popular frameworks like Django are not compatible with Python ...
68
votes
6answers
7k views

Why was Python's popularity so sudden? [closed]

Python first appeared in 1991, but it was somewhat unknown until 2004, if the TIOBE rankings quantify anything meaningful. What happened? What caused the interest in this 13 year old language to go ...
65
votes
9answers
27k views

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

There's a quote from a PyCon 2011 talk that goes: At least in our shop (Argonne National Laboratory) we have three accepted languages for scientific computing. In this order they are C/C++, ...
61
votes
8answers
9k views

Are there any design patterns that are unnecessary in dynamic languages like Python?

I've started reading the design pattern book by the GoF. Some patterns seem very similar with only minor conceptual differences. Do you think out of the many patterns some are unnecessary in a ...
54
votes
5answers
47k views

R vs Python for data analysis [closed]

I have been programming for about a year and I am really interested in data analysis and machine learning. I am taking part in a couple of online courses and am reading a couple of books. Everything ...
39
votes
13answers
9k views

How does Python's handling of line-breaks differ from JavaScript's automatic semicolons?

Javascript has a feature called Automatic Semicolon Insertion where basically if the parser encounters an invalid token, and the last token before that was a line break, then the parser will insert a ...
38
votes
7answers
22k views

Why use try … finally without a catch clause?

The classical way to program is with try / catch but when is it appropriate to use try without catch? In Python the following appears legal and can make sense: try: #do work finally: #do ...
38
votes
4answers
5k views

Experience of Python's “PEP-302 New Import Hooks”

I'm one of the developers of Ruby (CRuby). We are working on Ruby 2.0 release (planned to release 2012/Feb). Python has "PEP302: New Import Hooks" (2003): This PEP proposes to add a new set of ...
38
votes
7answers
38k views

How do I learn Python from zero to web development? [closed]

I am looking into learning Python for web development. Assuming I already have some basic web development experience with Java (JSP/Servlets), I'm already familiar with web design (HTML, CSS, JS), ...
37
votes
11answers
4k views

Is C# development effectively inseparable from the IDE you use?

I'm a Python programmer learning C# who is trying to stop worrying and just love C# for what it is, rather than constantly comparing it back to Python. I'm caught up on one point: the lack of ...
37
votes
8answers
7k views

Defensive Programming vs Exception Handling?

I'm working through the book "Head First Python" (it's my language to learn this year) and I got to a section where they argue about two code techniques: Defensive coding vs Exception handling. Here ...
36
votes
7answers
3k views

Are small amounts of functional programming understandable by non-FP people?

Case: I'm working at a company, writing an application in Python that is handling a lot of data in arrays. I'm the only developer of this program at the moment, but it will probably be ...
36
votes
8answers
5k views

How can I learn to effectively write Pythonic code?

Doing a google search for "pythonic" reveals a wide range of interpretations. The wikipedia page says: A common neologism in the Python community is pythonic, which can have a wide range of ...
32
votes
16answers
18k views

Why such popularity with Python? [closed]

Other than being annoyed at whitespace as syntax, I'm not a hater, I just don't get the fascination with Python. I appreciate the poetry of Perl, and have programmed beautiful web services in bash ...
31
votes
5answers
3k views

Java dev learning Python: what concepts do I need to wrap my head around?

I've run through a few tutorials and written some small projects. I'm right in the middle of a small project now infact. All is going well enough thanks in no small part to Uncle Google (who usually ...
30
votes
3answers
2k views

Python Forgiveness vs. Permission and Duck Typing

In Python, I often hear that it is better to "beg forgiveness" (exception catching) instead of "ask permission" (type/condition checking). In regards to enforcing duck typing in Python, is this try: ...
29
votes
1answer
15k views

Module vs. Package?

Whenever you do "from 'x' import 'y'" I was wondering which one is considered the 'module' and which is the 'package', and why it isn't the other way around?
28
votes
1answer
951 views

How to deal with a misnamed function in production code?

I've recently come across a Python library on GitHub. The library is great, but contains one glaring typo in a function name. Let's call it dummy_fuction() while it should be dummy_function(). This ...
26
votes
8answers
4k views

Is the algorithm more important than the programming language?

During the current (2013) Google Code Jam contest, there was a problem that took C++ and Java people 200+ lines of code as compared to Python people that solved the same problem only using 40 lines of ...
26
votes
4answers
2k views

Concrete examples of Python's “only one way to do it” maxim

I am learning Python and am intrigued by the following point in PEP 20 The Zen of Python: There should be one-- and preferably only one --obvious way to do it. Although that way may not be ...
24
votes
3answers
17k views

Why is Python written in C and not in C++?

In Python's tutorial one can read that Python's original implementation is in C; On the other hand, the Python implementation, written in C, (...) I'm very curious why was Python written in C ...
24
votes
8answers
2k views

Do frameworks put too much abstraction? [closed]

I've been programming for a little under a year and have some experience writing systems applications, web apps, and scripts for businesses/organizations. However, one thing I've never really done is ...
24
votes
4answers
4k views

Should I stick with or abandon Python to deal with concurrency?

I have a 10K LOC project written in Django with quite a deal of Celery (RabbitMQ) for asynchronicity and background jobs where needed, and have come to the conclusion that parts of the system would ...
23
votes
5answers
6k views

Is programming in Python faster than in C, C++ or Java?

There's a widespread belief among programmers that the more dynamic and loosely typed the language, the more productive the programmer will be in it. Guido van Rossum wrote about programming ...
22
votes
8answers
15k views

Ruby or Python? [closed]

This question is extremely subjective and open-ended. It might even sound like something I should just research for myself and make my own decision. But I'd like to put it out there and get some ...
22
votes
4answers
9k views

Why store a function inside a python dictionary?

I'm a python beginner, and I just learned a technique involving dictionaries and functions. The syntax is easy and it seems like a trivial thing, but my python senses are tingling. Something tells me ...
22
votes
7answers
13k views

Should we use python 2.6 or 2.7 or 3.x? [closed]

The version of python which I am using is 2.6, and there is a 2.7 and 3.x. Usually I use python for some trivial program/snippet. I realize there are some major difference between 2.x and 3.x. I would ...
21
votes
6answers
8k views

Programming language usage at Google

I have heard Google uses Python, Java and C++. But what I don't know is how is each of those programming language is used. I mean what is Python, Java and C++ is used for at Google. Why would they ...
21
votes
2answers
11k views

What's wrong with relative imports in Python?

I recently upgraded versions of pylint, a popular Python style-checker. It has gone ballistic throughout my code, pointing out places where I import modules in the same package, without specifying ...
21
votes
4answers
6k views

Why do iterators in Python raise an exception?

Here's the syntax for iterators in Java (somewhat similar syntax in C#): Iterator it = sequence.iterator(); while (it.hasNext()) { System.out.println(it.next()); } Which makes sense. Here's ...
21
votes
6answers
2k views

Functional programming compared to OOP with classes

I have been interested in some of the concepts of functional programming lately. I have used OOP for some time now. I can see how I would build a fairly complex app in OOP. Each object would know how ...
20
votes
5answers
1k views

Will Python 3.0's backwards-incompatibility affect adoption?

I visited Slashdot this morning to find out that Python 3.0 has been released. I know C# and Perl, but have wanted to learn Python for some time, especially after I saw its ease of use to create ...
20
votes
3answers
756 views

How do I express subtle relationships in my data?

"A" is related to "B" and "C". How do I show that "B" and "C" might, by this context, be related as well? Example: Here are a few headlines about a recent Broadway play: David Mamet's Glengarry ...
19
votes
4answers
2k views

Why aren't there other programming languages that compile to Python bytecode?

In Java, there are multiple languages that compile to Java bytecode and can run on the JVM -- Clojure, Groovy, and Scala being the main ones I can remember off the top of my head. However, Python ...
19
votes
6answers
3k views

Advantage of Learning Lisp for a Python Programmer

I am primarily a Python, Java, C++ programmer, and I've gained a recent interest in functional language. I'm thinking of picking up a LISP dialect: Clojure. Now, I've been working through tutorials ...
19
votes
9answers
6k views

Is it essential to learn algorithms to be a real programmer?

I'm a PHP programmer, and until now I have not needed to learn algorithms... Now I'm start learning Python (a real programming language), because I need to use matplotlib. Does it make sense to start ...
18
votes
11answers
3k views

If we can do functional programming with Python, do we need a specific functional programming language? [closed]

Using generators and lambda, we can do functional programming with Python. You can also achieve the same thing with Ruby. So the question is: why do we need specific functional programming languages ...
18
votes
11answers
4k views

Why hasn't C# gained much traction within the opensource community?

I'm not expecting C# to be on par with say Java or Python in the open source community, but it still surprises me just how far behind it is. 'Multi language' open source repos like google code or ...
18
votes
3answers
5k views

Why Was Python Written with the GIL?

The global interpreter lock (GIL) seems to be often cited as a major reason why threading and the like is a touch tricky in Python - which raises the question "Why was that done in the first place?" ...
18
votes
3answers
1k views

Why do so many languages treat numbers starting with 0 as octal?

I've read Where are octals useful? and it seems like octals are something that were once upon a time useful. Many languages treat numbers preceding with a 0 as octal, so the literal 010 is actually ...
18
votes
3answers
3k views

Why aren't there explicit access modifiers in Python:

If 'explicit is better than implicit', why aren't there explicit access modifiers in Python: Public, Protected, Private, etc.? I know that the idea is that the programmer should know what to do ...
17
votes
18answers
1k views

How do I “ease into” programming coming from a designer background?

Is there a way I can 'ease in' to programming. Like learning to use/modify CGI scripts to add some functions to a basic html site? Even if it's the only thing I learn it's still useful, right?. Unlike ...
17
votes
5answers
2k views

What does Tim Peters mean by “complex is better than complicated”? [closed]

In Tim Peters's poem "The Zen of Python" (PEP 20), there is a line that goes: Complex is better than complicated. I like the theme of the poem, but this particular line has always vexed me. What ...
17
votes
6answers
1k views

What is Python 20th and final guideline

Sometimes when my life needs some guiding light, I read the Zen of Python by Tim Peters and usually manage to get back on the tracks. Today was one of those days, so I checked it again. I've noticed ...
17
votes
4answers
16k views

Is Python Interpreted or Compiled?

This is just a wondering I had while reading about interpreted and compiled languages. Ruby is no doubt an interpreted language, since source code is compiled by an interpreter at the point of ...
16
votes
5answers
4k views

why there is no power operator in java / c ++? [closed]

While there is such operator - ** in Python , i was wondering why java and c++ havent got one too. It is easy to make one for classes you define in C++ with operator overloading ( and i believe ...
16
votes
3answers
2k views

How to solve the problem of nested comments

It appears in not just one language that comments can't be nested. Do you have a good solution for this problem? One workaround in C/C++ and Java is to only use the single-line comment but it becomes ...
16
votes
7answers
4k views

Learning to program in C (coming from Python) [closed]

If this is the wrong place to ask this question, please let me know. I'm a Python programmer by occupation. I would love to learn C. Indeed, I have tried many times, but I always get discouraged. In ...
16
votes
5answers
2k views

For what types of applications is Python a bad choice?

I just started learning Python, and I'd like to get some more context on the language. I realize that, in many cases, Python is a slow language relative to C or C++. Thus, Python is probably not the ...
16
votes
4answers
10k views

'import module' vs. 'from module import function'

I have always been using this method: from sys import argv and use argv with just argv. But there is a convention of using this: import sys and using the argv by sys.argv The second method ...