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)

3
votes
2answers
219 views

Do I need to learn python first to understand the part 2 of the book Test Driven development?

It seems like Python is used as a coding language for part 2 of Kent Beck's book Test Driven Development. I have read the first part of that book and started appreciating the value of TDD . First part ...
3
votes
5answers
307 views

python random with a skew

I am trying to create a very simple evolution algorithm for a creature simulator, what I would like to have is, both creatures have a trait and a dominance level, both noted by ints. their child's ...
4
votes
2answers
184 views

Designing a function with many optional components

I'm trying to figure out a good practice for designing a function with (many) optional components. For a specific example, say I am interested in designing a feature extractor function that takes as ...
4
votes
3answers
432 views

Space between negative sign and variable name

I tried doing a Google search, as well as searching this Stack Exchange site but could not find a question relating directly to this. The PEP 8 -- Style Guide for Python Code has lots of good style ...
4
votes
2answers
272 views

What is the preferred way of communicating between applications on the same system?

I'm designing a system that is built on several small applications written in python, some of these will be services and others will be programs that only run during special situations. What I need to ...
-1
votes
1answer
234 views

Would porting JPype to Python 3 be useful? [closed]

I have an open source project my company would like me to do with a small team, creating an adapter for the Oracle NoSQL database to be used in Python, but to do that we would need to be able to make ...
5
votes
2answers
356 views

How does a symbol table relate to a namespace?

The official tutorial uses the term symbol table in a few places where I would expect the term namespace. 1. Defining functions The execution of a function introduces a new symbol table used for ...
5
votes
4answers
428 views

Why isn't the ‘format’ method more widely used in Python?

I'm probably missing something here, after searching I couldn't find an answer. I've explored quite a few Python projects and one thing I keep noticing is the fact that the majority of them continue ...
14
votes
4answers
7k 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 ...
18
votes
3answers
4k 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?" ...
7
votes
1answer
368 views

Is using '{}' within format strings considered Pythonic?

I just learned you can write '{}{}'.format(string_a, string_b) instead of '{0}{1}'.format(string_a, string_b) in Python, i.e. you can omit the numerals for the string format parameters when you ...
7
votes
4answers
428 views

When to import names into the global namespace? (using x::y, from x import y etc.)

I've been programming in various languages for about 10 years now. And I still haven't figured out when it is a good idea to import something into the global namespace (using x::y in C++, from x ...
13
votes
4answers
540 views

Strategy for keeping up with (Python) language changes

Writing code that will still run years from now Programming languages change. Libraries change. Some code from 5, 10, or even 20 years ago might still run and produce expected results, whereas some ...
0
votes
1answer
240 views

Why does flask use Jinja2 and not xpath?

I'm just starting out with python and since I'm coming from a PHP background (thus have to adjust my mind to wrap around new concepts) one major question still stands without answer - why does Flask ...
2
votes
1answer
183 views

Good serialization solution for communication between Python AND Haskell programs? [closed]

I found this: http://msgpack.org/ But.. I've never used it, so I don't know what whether it is much good. Anybody has proposals? Basic requirements: serialize as many data structures used ...
1
vote
1answer
271 views

Portability: Python's C/C++ libraries/extensions vs JRuby's Java libraries

I've had some discussion with colleagues who chose to go with JRuby along the following line of argumentation: JRuby can make use of anything that is available in Java, ergo such programs are more ...
0
votes
1answer
894 views

Is python lambda “really formal” λ-calculus or just share the name?

Now and then I use the Python lambda. Is it so formal that it is safe to say that you can do formal lambda calculus with it? I just used it but I didn't fully understand whether the python lambda and ...
1
vote
2answers
624 views

What is the best way to plot 3D/2D plots with real time data? [closed]

First of all, I like to use Python, because it is easy to work with. I am not a programmer, so I prefer anything that is easy to use and understand. I understand that it might be faster to program 3D ...
2
votes
2answers
174 views

Changing __class__ in a factory?

I'm parsing a set of XML files of different kinds (these kinds are known in advance). These are my requirements: I want an object to represent each XML document (object-xml mapping) I'd rather ...
2
votes
2answers
299 views

How to fix bad fundamentals? [closed]

I am a native PHP developer, and have been for about a year or so. I love PHP and it was very easy for me to learn, but I have developed some bad habits along the way due to never having a formal ...
1
vote
3answers
332 views

Hacking Python “Requests” library.. How to start as an intermediate pythonista?

My question is conceptual, yet extremely vital for me. I'm an intermediate Python developer. I know fair enough about it, and actually use it on a daily basis. Now, I would like to transform my ...
8
votes
2answers
344 views

In python, is it considered better to define a module with functions or a module with a class that contains functions? [closed]

In my code either of the above two options would work equally well but I am interested in finding out the pros and cons of both approaches.
4
votes
2answers
230 views

Ensuring conceptual integrity in Python project with multiple programmers

One objection that I have often heard raised against Python that it is difficult to synchronize a team of many programmers on large Python project. Note: that synchronization is possible in such a ...
4
votes
1answer
538 views

Splitting documentation between docstrings and sphinx

I'm using a combination of docstrings and Sphinx to document my Python programs. With Sphinx's autodoc, I can write a lot of documentation into the source as docstrings. Is there any standard for ...
2
votes
4answers
874 views

NodeJS as an avenue towards learning JavaScript [closed]

I'm a backend programmer who works mainly in Python. I'll probably never want to be a full time front end developer, but with the goal of growing my skill set, I would like to become at least passably ...
4
votes
1answer
963 views

Loop Invariants in Python

I have a bit of experience with loop invariants but I'm not really clear on them. I'm trying to learn them through an example in Python. Can someone point one out or help me understand? I've ...
4
votes
2answers
435 views

Machine Learning With Categorical and Continuous Data

This question could go here or on S.O. perhaps... Suppose that your training dataset contains both categorical and continuous data such as this setup: Animal, breed, sex, age, weight, ...
2
votes
1answer
689 views

call sub function based on variable value

I have a function containing other functions. These function are called based on value of variable action. These sub functions are logically grouped - i.e., they all deal with file manipulation. ...
2
votes
1answer
147 views

How should I distinguish between built-in types in Python?

I have a function that accepts either a string or a dictionary as an argument. That is, it can be called as either: lookup_person({name: "John Smith", age: 57}) or lookup_person("John Smith") My ...
1
vote
2answers
631 views

Simplest token-system for authenticating and authorizating

I want to make Python script that will accept input from Vim and send it to my web-site. So basically I want to make Vim my text-editor for blog articles. Of course, I need to authenticate and ...
18
votes
4answers
7k 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 ...
3
votes
1answer
1k views

Is it possible to use python as a shell replacement? [duplicate]

Recently I was looking at python's shutil and subprocess etc... And I started wondering: wouldn't it be ok to use python instead of e.g. bash? What am I missing?
7
votes
3answers
378 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 ...
3
votes
1answer
935 views

What are your techniques for storing numpy structures in django database fields and how do you serialize them for http?

I want to publish a small web project that is supposed to contain some of my research results to present it to the scientific community. All my analysis I ran so far have been written in python ...
6
votes
3answers
2k views

Behavior Driven Development and Unit Testing in Python

We might be interested in starting to incorporate a unit test suite to our project, which is coded in Python (and it uses Redis, PostgreSQL and some third-party libraries, if that bears into the ...
6
votes
3answers
1k views

Python in Big Data?

Can python be efficiently implemented in big data field? To be precise I am building an web app that analyses really big data in medical health care field consisting of medical history and huge ...
1
vote
1answer
669 views

How does Django turn field name strings to field name variables?

I'm very new to python and (coming from Java) am trying to think in a "pythonic" way. I'm having trouble understanding how Django turns a function (or variable) name given in string to the actual ...
52
votes
5answers
39k 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 ...
1
vote
2answers
582 views

How to create an auto-grader in and for Python

I'm trying to create an auto-grader for one of my beginning programming courses for python. From my online search, I've come to know that it is effectively a unit test framework that tests the ...
7
votes
4answers
2k views

Google App Engine, what are the advantages and limitations?

First, does anyone know a specific advantage of Google App Engine for Python Apps? Is there some advantage over Heruko or Appfog? And about the database API? Now, what about the limitations? Are ...
1
vote
3answers
1k views

How did Python become popular as a scripting language? [closed]

I looked at it in my field of work, which is film and pretty much every software we use comes with python as a scripting language: http://en.wikipedia.org/wiki/List_of_Python_software That made me ...
2
votes
2answers
256 views

GPLv3 Project with BSD Library

I am working in a Python project that I want to release under the GPL3 license. This project has one file that uses the BSD lxml library . I really need to put reference of the BSD license in the ...
3
votes
1answer
233 views

Implementing Glicko Rating in Python

Recently, I've been trying to implement some working version of the Glicko Rating System for fun. However, I fail to understand how to programmatically isolate R in Step 2. As you can see R appears ...
6
votes
1answer
180 views

Algorithms to Determine How Much A Factor Contributes to A Total Value

Lets say that I have hundreds/thousands of objects(entries) in a database and each object contains 10 attributes. I have a way to quantitatively measure each attribute where a higher number implies ...
0
votes
1answer
210 views

Scientific software design [closed]

I asked this question over at stackoverflow and it was suggested a tighter form be posted here. Many early career numerical researchers face the prospect of having to create performance critical ...
10
votes
10answers
4k views

Do I have to learn html and javascript to create web applications?

I am an experienced Java programmer, and I want to create a complex web application requiring dynamic pages, drawings, etc (take SO as an example). Do I have to learn javascript/html in order to ...
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 ...
0
votes
3answers
138 views

What can I do with urllib?

I grasp that it can fetch internet resources, but I'm not really fully appreciating what that means. I was doing the challenges at pythonchallenge.com, and I got past the one that requires urllib to ...
5
votes
3answers
287 views

Why does Zend discourage “floating functions”?

Zend's Coding Standard Naming Convention says Functions in the global scope (a.k.a "floating functions") are permitted but discouraged in most cases. Consider wrapping these functions in a static ...
2
votes
8answers
713 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 ...