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)

1
vote
2answers
323 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: ...
0
votes
2answers
62 views

Need help understanding a recursion example in Python

Python is my first programming language, and I'm learning it from "How to Think Like a Computer Scientist". In Chapter 5 the author gives the following example on recursion: def factorial(n): if n ...
1
vote
1answer
351 views

Web application / Domain model integration using JSON capable DTOs

I'm a bit confused about architectural choices for the web-applications/java/python world. For c/c++ world the available (open source) choices to implement web applications is pretty limited to zero, ...
1
vote
1answer
166 views

Merge two different API calls into One

I have two different apps in my django project. One is "comment" and an other one is "files". A comment might save some file attached to it. The current way of creating a comment with attachments is ...
1
vote
1answer
391 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
73 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. ...
0
votes
1answer
70 views

How to implement a 'before' hook for RequestHandler in the webapp2 with conditional response?

Need to do some authentication checks before deciding what content to display. Ideally, I'd like to have a restrictive base handler, that would implement the "before" hook that could show an ...
-2
votes
1answer
226 views

building a chat bot for an e-commerce site

I was recently talking to a couple of friends who run a modest e-commerce website (Daily visitors: approx. 100,000,). They plan to have an in-site chat module to engage customers. Since the whole ...
2
votes
0answers
70 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
vote
0answers
156 views

Benefits of using object document mapping (ODM)

I am creating a web app on Flask and was planning to use mongodb. Most of the examples using this stack that I've come across have used an ODM of some kind and was wanting to figure out whether or not ...
1
vote
0answers
232 views

Watching file changes/additions/removal, but with an eye on partial transfer

I would like to monitor the filesystem in python, so that my application gets warned of the new file addition, file removal, or file change. Once the file is detected, the application starts ...
1
vote
0answers
111 views

Pythonic way to map a function from one module to a method of a global object

I'm writing a naive simulator for testing code which will run on an embedded system. The code being tested will import a bunch of modules, call functions in these modules and receive data on which it ...
1
vote
0answers
103 views

Inheritance and constricted referencing

Let's say I have BaseA and BaseB classes. BaseB can have to several references of BaseA instances. Now, we have two other classes, DerivedA and DerivedB that respectively inherit from BaseA and BaseB. ...
0
votes
0answers
35 views

Checking that a function is only run from __main__ in Python

I often end up with code files that can either be imported or run as __main__. It's easy to handle this by checking if __name__ == '__main__'. But sometimes if my main function gets too big I split ...
0
votes
0answers
20 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
14 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 ...
0
votes
0answers
28 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 ...
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
0answers
36 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 ...
0
votes
0answers
60 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 = ...
0
votes
0answers
52 views

streaming data in memory aggregation

We have a stream of data we're aggregating stats over and putting into a python dictionary (sent from kafka). Every X time interval, We update our database with these aggregated metrics. This ...
0
votes
0answers
57 views

subclass QAbstractTableModel - reuse as much code as possible

in my PyQt application I am heavily using the model/view approach. For every model I create, I do the following: class myModel(QtCore.QAbstractTableModel): def __init__(self, parent = None): ...
0
votes
0answers
58 views

Check some value between each function call

Can you recommend a nice way of checking a particular value between calls to a set of functions? E.g. something like this in Python (might not be terribly 'Pythonic'): self.error_code = 0 # this ...
0
votes
0answers
35 views

Choosing a database for a framework with both asynchronous and synchronous calls

I'm building a framework to work as an all-purpose astronomy pipeline and before I get too far into development I was hoping to run my needs by you all to see if there are any optimizations or ...
0
votes
0answers
57 views

HTTP API that wraps any Python-Scrapy spider

I have to write an HTTP API that wraps any Scrapy spider, it should accept Requests, execute them in Scrapy, and return data extracted by the spider and lets the user reuse the same code to extract ...
0
votes
0answers
37 views

Implementing FUSE for deduplication

I am new to FUSE and using python-fuse for writing a file system for data deduplication. Let's say, I have a directory named "metadata" and in that directory, there is a file foo and a directory ...
0
votes
0answers
237 views

Django web app with websockets

I want to make a web service using Django, but that also has websocket functionality. Having done a bit of reading, this is the tech stack that I'm looking at: --------------------------------- ...
0
votes
0answers
65 views

Distributing Contestant Entries Between Multiple Bins, Is this Knapsack?

I am an algorithm novice and am faced with a rather difficult problem. I am working with contests. There are contestant - individual player entry - contestants can have multiple entries into a ...
0
votes
0answers
87 views

Approach to statically analyze a Python code base

What approach should I use to statically analyze a Python code base? In particular, I am looking for ways to: extract and display the class hierarchy, extract and display class relationships, ...
0
votes
0answers
140 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 ...
0
votes
0answers
100 views

How to algorithmically add notes to an existing midi file relative to positions of existing notes in python

I have a midi file that I'd like to algorithmically add notes to relative to other notes that already exist in the midi file using python, or if it's easier using a different language I'm open to that ...
0
votes
0answers
174 views

Embed Python into Lua?

I've found a lot of things about embedding Lua into Python, but I was wondering is is possible to embed Python into Lua? I've searched for a while, and couldn't find anything on it, so maybe some of ...
0
votes
0answers
47 views

Is it possible to write plugins for cPanel in Python?

I'd like to know if it is indeed possible to to write plugins for cPanel in Python. While checking cPanel's site, it mentions both PHP and Perl. Also this question on their forums says it's possible ...
0
votes
0answers
134 views

Why does pkg_resources not find bloom in my virtualenv?

I'm trying to hack on the ROS bloom build system (https://github.com/ros-infrastructure/bloom). After I've made some edits, I build it and install it to a virtualenv to test using python setup.py ...
-1
votes
0answers
101 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 ...