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
0answers
20 views

What is the best way of using Java libraries from Python?

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
37 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
62 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
7 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
46 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 ...
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
42 views

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

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
votes
0answers
141 views

Picking a language for writing code [on hold]

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 ...
-3
votes
0answers
52 views

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

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 ...
1
vote
2answers
114 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
72 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 ...
-5
votes
0answers
34 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
votes
0answers
37 views

Forging SSL/TLS packets with Scapy (python) [closed]

My question is barely short and simple. I am trying to forge some SSL/TLS packets but I didn't found any librairies on Scapy so far. Are they some public SSL/TLS libs for Scapy? By SSL/TLS packets, I ...
8
votes
2answers
116 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 ...
0
votes
0answers
40 views

Why 'find' works but 'in' does not in this program [closed]

Some of you will recognize this from the EDX MIT 6.00.1x Course. So the idea is it checks a list of letters against a word and prints out letters that are found and leaves underscores where letters ...
-1
votes
0answers
18 views

how to create a SIP request with specific header fields values [closed]

I'm an intern at a telecommunications operator and my task is to create an application that enables me to send sip (session initiation protocol) requests with the header fields values that i specify , ...
-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 ...
-3
votes
0answers
61 views

High level programming or event driven programming? [closed]

In your opinion, which do you find more effective, event driven programming or high level programming? Please explain your answer simply (I'm not a genius!)
-1
votes
0answers
60 views

Python Script running without installing python [closed]

I am a beginner in Python/Web development/Django Framework. I have python installed in my local computer (A).I have written an application in Python language using the Django framework which works as ...
-4
votes
1answer
180 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
62 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): ...
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 ...
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
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 ...
0
votes
1answer
79 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 ...
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 ...
-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". ...
2
votes
0answers
59 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 ...
-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 ...
1
vote
2answers
77 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 ...
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 ...
-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
252 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
65 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
176 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
53 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 ...
0
votes
1answer
55 views

Storing primary keys of objects in Redis and then querying them in Postgres through Django

This is probably my second time posting in programmers. I'm usually on stackoverflow but this question is more fit for the community here. All suggestions, advice and insight on this matter is ...
7
votes
5answers
292 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 ...
0
votes
0answers
93 views

Using Python to traverse a parent-child data set [migrated]

I have a dataset of two columns in a csv file. Th purpose of this dataset is to provide a linking between two different id's if they belong to the same person. e.g (2,3,5 belong to 1) e.g 1. COLA ...
8
votes
1answer
391 views

Refactoring a 1500 LOC method that only builds the graphical UI [closed]

I'm currently scratching my head over how to refactor a method that basically only builds the UI. The method is more than 1500 lines of code (LOC) long - and counting. It has grown, there was no plan ...
2
votes
1answer
106 views

Where to implement thread-safety logic for my queue data structure?

I will immediately confess that I do very little multithreading, so questions of style and organization in this domain a little fresh to me. I've written a data structure (in Python, if that matters) ...
0
votes
1answer
71 views

How to write a good mock for testing

I code in Python and I'm starting to use the Mock library. Although I've read through all of the documentation, something that I'm finding hard to understand is 'What makes a good mock'. For ...
0
votes
0answers
32 views

Search substring using suffix array (and LCP)

I'm searching for a best way to improve suffix array run time using LCP. My text (about 2 500 000 chars) seems like: 0ricco0eric0america0polo0.... My thoughs: SA=suffixArray char=firstChar(input) s ...
4
votes
1answer
2k views

Which low-level programming language is most similar to Python? [closed]

I'm trying to discover a low-level language that is similar in how code is written in Python. I am not familiar with all technical terms relating to programming languages, but if you can think of it ...
0
votes
1answer
75 views

“Saving method name in a variable: Python”, How does this code works? [closed]

I am trying to make sense of the following code snipet: factor = misc.kkt_chol2(G, dims, A) .... .... factor(W, P) How the parameter in factor binding with the parameters inside kkt_chol2? Thank ...
0
votes
1answer
37 views

Python shelve class rename

The main reason I use Shelve is to be able to quickly develop code without worrying about db table structure. Unfortunately changing a class name from, say, 'class1' to 'class2' gives "AttributeError: ...
-3
votes
1answer
103 views

Sqlite3 slow on standard queries, is it expected? [closed]

Using Python and sqlite3. This simple print loop takes a few seconds to execute. I don't know much about databases, so I'm guessing I'm not using these queries correctly. Surely sqlite should be ...