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 ...
-1
votes
0answers
44 views
Python Script running without installing python
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 ...
-3
votes
2answers
36 views
Generate PDF from Template, preferably using Python [on hold]
I need to generate a set of reports based on some results from a python script I've created. The reports need to be able to insert an image (which I've stored a PNG), a title and general information ...
-3
votes
0answers
52 views
Could I develop a big scale website with only python (no frameworks)? [on hold]
I just started grasping python and as I have some general knowledge on how dynamic websites are built, I'd like to straight away develop a website with Python. I've tried Django and it seems I have to ...
0
votes
0answers
25 views
Object attribute needed at package level with python [on hold]
Let's consider the following scenario.
We have a Python 2.7 package which serves as a library for some scripting projects. We have a jli.py and a server.py modules within our package:
___init__.py:
...
-4
votes
1answer
159 views
High level languages compared with visual programming environments [on hold]
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 ...
-4
votes
0answers
85 views
Fear of web developement [closed]
I start programming at the age of 15 with php my first real language. Since the age of 16 I've learned more about php and web-developement in general. Even though I was warned by many people that php ...
0
votes
1answer
45 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
45 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
votes
0answers
69 views
Should I learn CGI or a framework for web development with Python? [closed]
My background:
Fluent with Python (conditionals, loops, functions, classes), HTML & CSS. Have some background in JavaScript and can create sign-up pages, users having their own accounts etc. ...
0
votes
0answers
22 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
69 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
74 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
60 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
49 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
53 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
41 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
74 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
89 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
147 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
246 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 ...
0
votes
0answers
6 views
A simple substitution cipher problem in Python 2 [migrated]
The code below shifts each letter of the plaintext message 2 positions in the alphabet. The problem is this code doesn't loop back to beginning of the alphabet after the letters y and z or Y and Z. ...
2
votes
1answer
59 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
173 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
50 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 ...
-1
votes
0answers
14 views
copying same file name from client to server using tcp protocol with same size of file [migrated]
This is the client and server program where a client sends a file to server to save in the server. There is a issuse in that same file name is not getting copied on the server with same file size
...
0
votes
1answer
49 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 ...
6
votes
5answers
286 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
2answers
70 views
Using Python to traverse a parent-child data set
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
388 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
103 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
67 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
36 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 ...
3
votes
3answers
145 views
Unit Testing: How much more code? [duplicate]
I'm fairly new to unit testing. In school it's always been, "hey it works, onward!" But I've started to write professionally, and even at work that's been basically the mantra. However, I've started ...
4
votes
2answers
229 views
Should duck typing affect naming conventions?
I'm a C++/C# developer and recently I've started to learn Python. I think I understand the concept of duck typing right now except for one thing.
When I'm coding in C++ or C# I sometimes create ...
28
votes
1answer
949 views
How to deal with a misnamed function in production code?
I've recently come across a Python library on GitHub. The library is great, but contains one glaring typo in a function name. Let's call it dummy_fuction() while it should be dummy_function(). This ...
-4
votes
1answer
39 views
cx_Freeze'd application license [closed]
I have a python program packed to .exe using cx_Freeze. I am trying to understand licensing implications:
do I have to reproduce cx_Freeze license agreement?
do I have to reproduce python license ...
0
votes
1answer
126 views
Is the following example a strategy pattern?
In my problem I had lots of objects with slightly different behaviour, but identical attributes and methodes with identical interfaces. The objects variants were quite big in number, and I didn't want ...
2
votes
0answers
234 views
Why are so many Python files really big (5k+ lines)? [closed]
Is there any specific reason driving Python files to often be so large? Python files may contain several classes within one file, and some files go up over 10k lines in length. This seems to go ...
4
votes
2answers
196 views
Using a closure to avoid code duplication in Python
Sometimes I find myself wanting to run the same code from a few different spots in the same function. Say I have some function func1, and I want to do the same thing from a few different spots in ...
0
votes
0answers
48 views
Gevent - Make blocking calls non-blocking
I have the blocking code shown below.
Is calling monkey.patch_all() enough/optimal to make it non-blocking?
Does Gevent handle iterations like these?
# front page
def front_page():
database = ...
-1
votes
3answers
197 views
Finding the name of a video game with a picture of its cover (Python/Java) [closed]
For the past few days, I've been trying to figure out how to take an image of a video game cover (like this one) and get the name of the game from it. Initially I attempted to use Google's Search by ...
-3
votes
1answer
136 views
Is there a purely technical term for 'monkey patching' [closed]
EDIT The original title of the question was Is there a non-derogatory term for 'monkey patching'. As I have learned that the term is actually not derogatory, or is at least not meant to be, I changed ...
1
vote
1answer
76 views
Is it possible to get probabilities from a support vector machine?
From what I understand, SVM's take a discrete number of x and y values from which to learn from, then when given new x values map it to one y value (category). Is it possible to use SVM's or something ...
13
votes
2answers
529 views
Creating nested functions for purely aesthetic reasons?
I've always wondered what other programmers think about the idea of creating pure aesthetic functions.
Say I have a function that processes a chunk of data: Function ProcessBigData. Say I need ...