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)

42
votes
8answers
8k 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 ...
38
votes
7answers
4k 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 ...
42
votes
7answers
47k 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), ...
72
votes
9answers
34k 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++, ...
-1
votes
1answer
248 views

How do I create every permutation [closed]

I have a list of letters, this is just an example list: ['a','b','c','d','e'] How do I compute every combination of the list? The letters cannot repeat, for example. a,b,c,d,e a,c,b,d,e a,c,d,b,e ...
127
votes
9answers
29k 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 ...
48
votes
7answers
31k 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 ...
14
votes
6answers
3k views

Best practices in comment writing and documentation

Commenting nowadays is easier than ever. In Java, there are some nice techniques for linking comments to classes, and Java IDEs are good at making comment shells for you. Languages like Clojure even ...
18
votes
9answers
7k views

Is it essential to learn algorithms to be a real programmer? [closed]

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 ...
10
votes
6answers
585 views

As a beginning programmer, should I favor building my own libraries over using 3rd-party libraries?

As a beginning Python programmer, is it a good idea to build and understand my own libraries before jumping to advanced 3rd-party libraries that contains the functionality I need? Some projects (e.g. ...
16
votes
1answer
540 views

What are the problems python 3 new features solve?

Python 3 new features say: we’re mostly fixing well-known annoyances and warts, and removing a lot of old cruft It mentions what is different (the fix) but not why (the problems). I have have ...
18
votes
7answers
5k 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 ...
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 ...
32
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: ...
22
votes
8answers
17k 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 ...
20
votes
4answers
21k 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 ...
23
votes
7answers
16k 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
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 ...
16
votes
8answers
1k views

What are good unit tests to cover the use case of rolling a die?

I'm trying to get to grips with unit testing. Say we have a die which can has a default number of sides equal to 6 (but can be 4, 5 sided etc.): import random class Die(): def __init__(self, ...
15
votes
7answers
6k views

Python productivity VS Java Productivity

Over on SO I came across a question regarding which platform, Java or Python is best for developing on Google AppEngine. Many people were boasting of the increased productivity gained from using ...
13
votes
4answers
3k views

Best practices for execution of untrusted code

I have a project where I need to allow users to run arbitrary, untrusted python code (a bit like this) against my server. I'm fairly new to python and I'd like to avoid making any mistakes that ...
11
votes
4answers
5k views

Why doesn't Python allow multi-line lambdas?

Can someone explain the concrete reasons why BDFL choose to make Python lambdas single line? This is good: lambda x: x**x This results in an error: lambda x: x**x I understand that making ...
4
votes
10answers
1k views

I'm 15 years old. What would you recommend for resources? [closed]

I'm a 15 year old kid who seems to excel in all of his classes, likes talking in 3rd person, and wants to learn more about programming and a little about html/php stuff. I already know a little ...
8
votes
11answers
1k views

How does one become proficient in a language and its idioms?

I'm a recent graduate and there are a few (three generally) languages I switch between based on the requirement. What I've found is I always have to look up syntax whenever I code. I know I'm not ...
3
votes
2answers
852 views

Why do ruby and python seem to have more community contribution than PHP? [closed]

In a recent blog post by Roy Osherove, it is pointed out that his switch from primarily .Net development to ruby development has seen a huge difference in community involvement and really enjoys it. ...
18
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 ...
6
votes
6answers
2k views

How does rapid prototyping fit into an agile methodology?

I work for a large company, which dictates the use of agile processes. For example, for our projects, we use cloud-based services that are specifically targeted at managing agile development. The ...
6
votes
3answers
482 views

What are the challenges related to typing in writing a compiler for a dynamically typed language?

In this talk, Guido van Rossum is talking (27:30) about attempts to write a compiler for Python code, commenting on it saying: turns out it's not so easy to write a compiler that maintains all the ...
6
votes
2answers
644 views

Why does the word “Pythonic” exist? [closed]

Honestly, I hate the word "Pythonic" -- it's used as a simple synonym of "good" in many circles, and I think that's pretentious. Those who use it are silently saying that good code cannot be written ...
1
vote
4answers
475 views

Multiple attribution in Python, JS, …?

I accidentally discovered this a=b=c=d=e=f=2 in python(2.7)(and JavaScript a few minutes later) interpreter . Is this a feature or just the way the interpreter works, if is a feature how it is ...
5
votes
2answers
375 views

Writing functional tests for a legacy project

I am trying to add a couple of tests to a legacy C project. The project basically consists of a command line tool that prints something to stdout every time an event happens. Now, since writing unit ...
4
votes
3answers
1k views

Python lower_case_with_underscores style convention: underscores not popular?

PEP8 recommends using lowercase, with words separated by underscores as necessary to improve readability for variable and function names. I've seen this interpreted as ...
66
votes
8answers
10k 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 ...
67
votes
6answers
8k 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 ...
33
votes
16answers
22k 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 ...
37
votes
8answers
7k 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 ...
27
votes
8answers
5k 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 ...
9
votes
5answers
7k views

Moving to Python (SciPy and NumPy) for Scientific Computing [duplicate]

Just read a presentation about using Python for Scientific Computing. I am currently using MATLAB (student license FTW, which will expire when I graduate soon). So I was wondering how matured SciPy ...
20
votes
11answers
4k 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 ...
17
votes
8answers
4k views

I feel stuck in the center of Python, How to get past beginner

I really apologize if this doesn't follow the S.O rules but I need a little help, I personally still classify myself as a beginner in python, Yet I've wrote a very small and VERY SURE impractical ...
6
votes
4answers
1k views

Learning Python is good? [duplicate]

Possible Duplicate: Is Python worth learning? Is it a useful tool? Recently I have seen some videos from MIT on computer programming topics. I found it's really worth watching. Especially ...
7
votes
4answers
9k views

Java or Python for internet application? [closed]

In choosing a technology for internet applications where the number of users may scale over time, which one should we consider: Java or Python? What are the considerations in choosing one and not the ...
6
votes
6answers
4k views

Why should we use low level languages if a high level one like python can do almost everything? [closed]

I know python is not suitable for things like microcontrolers, make drivers etc, but besides that, you can do everything using python, companys get stuck with speed optimizations for real hard time ...
8
votes
2answers
10k views

Open source projects, how to choose?

I would like to join an open source project since I think I am good enough at programming to progress onto reading others code and to modify it. But the problem is, how would I choose an open source ...
2
votes
8answers
884 views

tips, guidelines, points to remember for rendering professional code? [closed]

I'm talking about giving clients professional looking code. The whole nine yards, everything you hardcore professional highly experienced programmers here probably do when coding freelance or for the ...
16
votes
5answers
9k views

How difficult is Python and Django to pick up for a Java/.NET web developer? [closed]

I just started a new job a couple months ago at a small company where I am currently leading all development efforts present and future. I personally have years of experience in software design and ...
8
votes
10answers
37k views

How long would it take to learn Python? [closed]

I have decided to take the time out after work to learn Python. Python appeals to me because at work (Web and eLearning Company), I have to follow out very repetitive tasks like delete all these tags, ...
8
votes
15answers
3k views

Python and only Python for almost any programming tasks!

Am I wrong if I think that Python is all I need to master, in order to solve most of the common programming tasks? EDIT I'm not OK with learning new programming languages if they don't teach me new ...
7
votes
5answers
566 views

Algorithm for flattening overlapping ranges

I am looking for a nice way of flattening (splitting) a list of potentially-overlapping numeric ranges. The problem is very similar to that of this question: Fastest way to split overlapping date ...
7
votes
3answers
4k views

Differences between “Java OOP” and “Pythonic OOP”? [closed]

I started with ActionScript 2.0 and then went on with Java. I have learned, or at least used, a bunch of languages since then, including Python (probably my favorite). I'm afraid that my style of ...