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)

0
votes
1answer
5 views

How to import mysql modules in Python?

As you are aware, I am a complete noob on this. I am trying to use this reusable class to connect to mysql Python Connection with MySQL But whenever i try to run the python I am getting Traceback ...
0
votes
0answers
12 views

Abstracting away scrapy's parse() method - good idea or not?

We use Scrapy quite a bit at work, and recently it's been decided that the spiders we write with it are all too 'different' in the way they're written and could use a little bit of 'standardization' ...
-2
votes
0answers
25 views

How to pass dictionary(hash value) as command line argument to python script? [on hold]

Here I m passing dictionary as command line argument to python script >python post_request.py ...
0
votes
0answers
23 views

Learning from basics - which language to choose [on hold]

I am from commerce background have zero computer science and coding experience. I work with a electronic market trading set up which nowadays is High frequency trading.I have to learn some language ...
0
votes
0answers
22 views

What job queue system library is best for a SaaS? [on hold]

Customers subscribe and are allocated X number of jobs that can be run in a month. Say, a free plan lets user run 10 jobs a month. A small plan lets user run 100 jobs a month. These jobs are ...
2
votes
0answers
64 views

The inheritance argument of zope.interface (providedby vs isinstance)

What limitations does inheritance of an interface through an abstract base class present that are addressed by zope.interface? In the following talk given in 2010 by Jeff Rush about interfaces, at ...
-3
votes
0answers
41 views

Help in Simple Python Program [on hold]

I am writing a simple Python password validation program. A website requires the users to input username and password to register. Write a program to check the validity of password input by ...
-2
votes
0answers
33 views

What is the best way of using Java libraries from Python? [on hold]

There are plenty of math and scientific libraries written in Java. I prefer Python for programming though. I have tried Jython but it gets very laborious and convoluted at the moment of distributing ...
-2
votes
0answers
50 views

Python code to find unique combinations of factors of a number [on hold]

I have the below code which prints the unique combination of factors of a given number. But I does not give the desired output. The code is a s follows: #Print the factors list for the given number ...
2
votes
2answers
70 views

subclass reference to another subclass

Imagine I have the following code: class A: pass class B(A): pass class C(A): def __init__(self): self.b = B() Is the above code correct in terms of correct inheritance? I ...
0
votes
0answers
9 views

Defining property and find substitution for copy function of python in cython

I want to cythonize a code in python to speed up the code. In the following you can see my attempt to make my python class understandable for cython: import numpy as np cimport numpy as np ctypedef ...
2
votes
1answer
50 views

Python API: Extension Module or Pure Module

We have a C++ application, with C++ interfaces changing regularly during development. We also have a C API which is designed to be stable in spite of such changes; the C API is tighly focused on ...
-3
votes
0answers
55 views

How to build an application(dash board) to monitor Sybase ase database server by python? If so please share details [closed]

In this moment we are monitoring sybase ASE database server by shell script(cron job) these data we are pushing to other database server what we call is monitoring server.After business hrs we are ...
8
votes
2answers
120 views

Early attempt to remove Python GIL resulted in bad performance: Why?

This post from Python creator, Guido Van Rossum, mentions an early attempt to remove the GIL from Python: This has been tried before, with disappointing results, which is why I'm reluctant to ...
1
vote
1answer
54 views

Adding new functionality to all of shelve.Shelf's subclasses in Python

In order to avoid the overhead associated with the shelve module's writeback option I'm interested in putting together a shelf class that only accepts hashable values, with hashability being a proxy ...
-2
votes
0answers
20 views

Syntax error in visual studio [migrated]

I started Udacity's Intro to Comp Sci course today, and generated this code at the end of the first lesson: page = '<a href="http://udacity.com">Hello world</a>' start_link = ...
-4
votes
0answers
44 views

Which MVC framework to pick for my project and why? [closed]

I'm building a reporting application that I expect to deploy in different financial organizations. The choices I have are Java on Play, Django or Ruby on Rails. I have played around with rails and it ...
1
vote
2answers
116 views

Can a version of Python's shelve module that knows when its entries have been modified be written in any programming language?

shelve is a Python module that makes it easy to persist a Python dictionary to disk (under the right conditions). The documentation for shelve gives this example to demonstrate one of the pitfalls of ...
-1
votes
0answers
148 views

Picking a language for writing code [closed]

I'm in a situation, which I guess would've been encountered by all professional programmers at some point. For the same of rapid development, I chose to write modules in python. Soon, in our perf ...
-1
votes
0answers
74 views

Automatically expose large software library using web services? [closed]

(Edited from initial post) Lets say I want to automatically generate web-service wrappers for some large arbitrary source code library (it doesn't matter which language). The aim is touch-free ...
-1
votes
0answers
98 views

Python service oriented application vs. non-service one

I'm looking forward starting a new web application with Python and I have some doubts before starting. My idea is building a web application and later maybe an Android/iOS mobile app. I am considering ...
-5
votes
0answers
35 views

Mixing arrays of different types in python [closed]

I'm trying to accomplish a certain task in Python that can be best described in short through the following example scenario. Suppose I want to calculate an array representing the polynomial ...
1
vote
1answer
385 views

Is there a module for writing low level code on Python?

Can you manipulate bits and memory directly using Python? If yes, wouldn't that be a best option to dealing with performance-critical spots than C bindings?
0
votes
1answer
64 views

Making a sldprt to PDB file converter?

I wanted to create a parser that can read a solidworks file and turn it into a protein data bank file. This has already been done in a program called DiamondCAD. ...
10
votes
5answers
2k views

Is it considered Pythonic to have multiple classes defined in the same file?

In working with python for the first time, I've found that I end up writing multiple classes in the same file, which is opposed to other languages like Java, which uses one file per class. Usually, ...
0
votes
1answer
287 views

Front-end structure of large scale Django project

Few days ago, I started to work in new company. Before me, all front-end and backend code was written by one man (oh my...). As you know, Django app contains two main directories for front-end: ...
-4
votes
1answer
187 views

High level languages compared with visual programming environments [closed]

Could I have a professional view on the effectiveness of visual block-based programming environments ( a program such as 'blockly' or 'scratch' or 'app inventor') in comparison to high level ...
1
vote
1answer
483 views

scons and python unit tests best practices

I am using scons to build a large project containing a mix of C++ and Python. I would like scons to run Python unit tests either using nose or not. Currently, we have a long list of tests files and ...
0
votes
1answer
49 views

Measuring performance of a network simulator?

I have written a python program to test a new network routing algorithm, that uses a Content Centric Network Approach for handling requests (CCN), where the CCN router keeps 3 data structures: A ...
1
vote
1answer
63 views

Using class like an object in Python

I am learning from Learn Python the hard way where I have come across a study drill where they want to know that whether a class can be used like an object. As I have experimented: class A(object): ...
1
vote
2answers
79 views

How would I change the precision of a variable in Python?

I'm working on a 2D-physics engine, and I need a certain variable to be precise only to the hundredths. Are there any methods for basically shaving off all of that unneeded precision? I have tried ...
0
votes
0answers
25 views

API providing function to be run in a thread vs. thread that runs this function

I'm writing a Python library which exposes a certain event listener interface. The user can register callbacks to handle different types of events. There is also a function which handles the actual ...
3
votes
2answers
74 views

Object identification in Python

In learning Python, I found that when two "names" (or "variables") are assigned to the same value, both of them point to the same memory address. For example >>> a = 10 >>> b = 10 ...
0
votes
1answer
81 views

How to avoid Memory Error

I am working with quite large files (pytables) and I am having problems with the Memory Error when I try to load the data for processing. I would like some tips about how to avoid this in my python ...
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 ...
2
votes
1answer
64 views

Random forest ML algorithm suitable for use on cluster based HPC?

I need help in identifying a better algorithm. I have developed a script using pythons scipy package to analyse a rather large model that I wish to solve. The model contains over 12GB of data ...
0
votes
0answers
14 views

How to change the content of a string in python [migrated]

I have a blog in the following website http://ecosdobigbang.com/ where I'll post material that is relevant to Physics students that speak portuguese (the target audience of this post are physics ...
-2
votes
2answers
53 views

Is the tool pywebsocket suited for production? [closed]

Is it a good idea to use pywebsocket in a production environment, since it is so widely used, but their google developer page states "pywebsocket is intended for testing or experimental purposes". ...
-1
votes
0answers
4 views

Cookies in python [migrated]

I am trying to write a script in python which uses the Cookie library to set cookies. I have written the following method: import uuid import Cookie import sys import os def send_cookie(key, value, ...
-1
votes
2answers
42 views

Minima of a convex list using binary search [closed]

A list is strictly convex if its elements first decrease then increase. How can I write a function in python that accepts a convex list and returns its minima in time complexity O(log(n)), n being the ...
5
votes
3answers
401 views

Multiple sites with the same codebase in Python

I am trying to run a large amount of sites which share about 90% of their code. They are simply designed to query an API and return the results. They will have a common userbase / database but will be ...
0
votes
0answers
131 views

Extending user registration in Django site that uses both site admin tables and my own module?

I'm writing a Django site that registers a particular type of user and this is done by the resources that come with the framework, the site administration. The issue: I'd like to create a new model ...
1
vote
1answer
90 views

Is it possible to have a mutable type that is not garbage collected?

I'm wondering if such a thing can exist. Can there be an object that is mutable but not flagged as garbage collected ( specifically, tp_flags & Py_TPFLAGS_HAVE_GC ) I have a C++ struct-like ...
1
vote
4answers
398 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 ...
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 ...
-3
votes
1answer
150 views

Is it recommended to use more than one language at a startup? [closed]

I work for a mobile startup where, for historical reasons, our chosen language was C#. I was recently assigned to a small project to build a tool that would be used by us internally. When I explained ...
0
votes
1answer
255 views

Why isn't there a python compiler to native machine code?

As I understand, the cause of the speed difference between compiled languages and python is, that the first compiles code all way to the native machine's code, whereas python compiles to python ...
2
votes
1answer
66 views

Single python file distribution: module or package?

Suppose I have a useful python function or class (or whatever) called useful_thing which exists in a single file. There are essentialy two ways to organize the source tree. The first way uses a single ...
4
votes
0answers
177 views

Creating a bare bone web-browser: After the html parser, javascript parser, etc have done their work, how do I display the content of the webpage? [closed]

This is a personal project to learn computer programming. I took a look at this: https://www.udacity.com/course/viewer#!/c-cs262 The following is the approach taken in it: Abstract Syntax Tree is ...
0
votes
0answers
54 views

Converting large files in python

I have a few files that are ~64GB in size that I think I would like to convert to hdf5 format. I was wondering what the best approach for doing so would be? Reading line-by-line seems to take more ...