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 ...
3
votes
1answer
46 views
optimize human-readable database with index
i need to store a large amount of data - about 10 million entries of the format
unique hash (64 chars), value 1 (5 chars), value 2 (9 chars)
i will be reading and deleting (but not updating) this ...
2
votes
2answers
48 views
where exactly should python business logic be placed in django
I have just begun to learn Django/Python/Web Development. This problem has been troubling me for a while now.
I am creating an application with multiple templates in Django. I have a views.py which ...
-3
votes
2answers
139 views
A newbie in python trying to learn [on hold]
Am trying to learn how to program before i go to uni and i stumbled upon a question which i have been unable to do.
In the function write code to input two integers m and n and calculate and display ...
0
votes
0answers
15 views
How to deal with multiple output modes of multiple types?
Note: The business domain being a bit complicated to explain, I replaced the names of actual classes by more illustrative examples.
I'm writing an application in which the business layer returns a ...
0
votes
0answers
37 views
How to build a strong base in programming? [on hold]
I am currently pursuing a Computer Engineering degree more focused towards hardware (circuit design, microprocessors etc) but I also want to be good at programming. I just feel that I lack a strong ...
-9
votes
0answers
45 views
High-level programming and event driven languages [on hold]
What are the advantages and disadvantages of high-level programming and event driven programming?
-1
votes
0answers
12 views
How will i close a pdf document which is opened through os.startfile [on hold]
My program require a way to close a pdf which is opened through os.startfile. since i require to create a watermark on that pdf once i press OK button. Only that file to be closed. for example. if two ...
-1
votes
0answers
15 views
How to import mysql modules in Python? [migrated]
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
22 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
33 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
25 views
Learning from basics - which language to choose [closed]
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
27 views
What job queue system library is best for a SaaS? [closed]
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 ...
-3
votes
0answers
49 views
Help in Simple Python Program [closed]
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
34 views
What is the best way of using Java libraries from Python? [closed]
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
57 views
Python code to find unique combinations of factors of a number [closed]
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
74 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
11 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 ...
1
vote
1answer
57 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 = ...
-3
votes
0answers
57 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 ...
1
vote
2answers
119 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 ...
9
votes
2answers
142 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
votes
0answers
99 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 ...
-4
votes
1answer
190 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
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):
...
0
votes
1answer
50 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
27 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
87 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
65 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
54 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
65 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
44 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
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 ...
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
259 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
180 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
55 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
57 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
298 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 ...
8
votes
1answer
394 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
110 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
33 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 ...