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)

-2
votes
0answers
10 views

Script Execution Proccess not doing what it should be doing in theory?

Forgive me for the beginner question, but here I have a Python 2.7.10 Script that I wrote which does not execute as I expected it to: frReq=int(raw_input("Friends?")) friends=[] for i in ...
0
votes
0answers
44 views

Python classes with only one instance: When to create a (single) class instance and when to work with the class instead?

Given a python class which will be instantiated only once, i.e. there will be only one object of the class. I was wondering in which cases it makes sense to create a single class instance instead of ...
0
votes
0answers
6 views

Logical Structure of PyQt or PySide application that conforms to resuability

I am making a pyqt application, that has a QDialog UI as main widget that contains QTabWidget, this QtabWidget has two tabs, each tabs sits in a source folder under _widget. So I am not exactly sure ...
-4
votes
0answers
20 views

skewtest and kurtosistest: references [on hold]

I use the functions skewtest and kurtosistest from scipy.stats. These functions test for deviations of the third or fourth moment from a normal distribution. I would like to know what these functions ...
3
votes
3answers
355 views

Is this OOP class hierarchy too deep?

So I am making a Super Mario Bros NES clone in pygame and for all enemies that are drawn to the window, I have a class hierarchy that is 5 classes deep. Going in the order of: Object (A base class ...
0
votes
0answers
19 views

Writing a Python class that provides default instance succinctly [migrated]

I have a Python class for which I'm often going to want an instance with the default arguments, but I want the class to allow creation of instances. For brevity I'd prefer that the default instance be ...
-3
votes
0answers
26 views

What python version should my package support? [on hold]

If you are programming package that support 2.7, 3.3, 3.4 python version would be this considered to be well accepted in to the python community?
2
votes
2answers
251 views

Which programming idiom to choose for this open source library? [closed]

Which programming idiom is easier to use for beginner developers writing concrete file parsing classes? I'm developing an open source library, which one of the main functionality is to parse plain ...
0
votes
0answers
27 views

Would using the django-major-event-log app satisfy HIPAA's event logging requirements?

I'm trying to figure out the easiest way to implement event logging with Django so as to meet HIPAA's event logging requirements. Would using https://github.com/unt-libraries/django-major-event-log ...
-4
votes
0answers
31 views

How do i put a mysql cursor command in a loop in python [on hold]

this is the code i have so far but its not looping it only return the first and not the others. class moments(): def __init__(self): cursor.execute("SELECT item_code FROM list WHERE user=%s ...
1
vote
2answers
155 views

using one database connection across multiple functions in python

whats the best way to go about this in python? I have a number of like so def test1() .... code ..... def test2() .... code ..... def test3() .... code ..... how could I create one ...
1
vote
1answer
164 views

Could there be a use case for C# style auto-properties in Python

I've been doing a lot of work in C# recently (my primary language is Python) and I love that I can do something like public string MyProperty{ get; set; } Going back to Python I miss that sort of ...
0
votes
0answers
39 views

Writing a container that treats nearly-identical images as the same

I want to create a mapping in Python that will use images as keys, but treat similar (but not identical) images as the same key. I have an approach for deciding which images are similar enough: I ...
0
votes
1answer
69 views

Normalizing a numpy array

I checked a while back for questions relevant to my own about normalizing numpy arrays but couldn't find any. So I'll pose my question following this line of code: for i in ...
-3
votes
0answers
21 views

Pygame for Intel processor [on hold]

I downloaded Python 3.4 64 bit IDE and pygame but whenever I tried installing pygame it would say "Not supported on Intel". So are there version of pygame available for Intel processor or are there ...
2
votes
1answer
181 views

Is there a better algorithm to distribute integer to X integers minimizing their difference?

Is there a better algorithm to distribute values from one source to X destinations minimizing their difference? I have some source integer. I need to know how much of that value I need to distribute ...
-3
votes
0answers
38 views

Python: How to translate code from 1.5.2 [on hold]

So today I went to my local library because I decided to take my journey with python a step further. Naturally, I logged on to the library's intranet and searched for "Python programming language", ...
-1
votes
0answers
26 views

What is the best way to install Django app on a client's PC? [on hold]

I am a beginner developer. I have made a basic Inventory Management application in Django for a small shop. They have one PC and would just like access to the app offline. I was thinking of installing ...
1
vote
1answer
29 views

How to represent alternative and sequential tasks?

I am experimenting with hierarchical task planning (in python) and I would like to have functions which return lists of tasks. I need to differentiate between alternative paths and sequential tasks. ...
-1
votes
0answers
15 views

Kodi addon with LXML is not parsing properly [closed]

I'm writing a scraper for Kodi, that scrapes a video page, and I'm doing it with LXML, but sometimes(sometimes it works ok), when I call tree.xpath(xpath) it says 'NoneType' object is not callable. ...
3
votes
1answer
76 views

Structuring a Python Project: Need some guidance

I currently am working on a project that involves several discrete components that have some common functionality, and I am in need of some advice. Right now I have a central component responsible ...
2
votes
1answer
64 views

Best practices for a daemon that forks and becomes user

I want to write a small daemon in python under Linux that accepts connections and authenticates the user (details for this don't matter) and then forks a child for the connection and becomes the user. ...
0
votes
1answer
29 views

Optional text qualifier in CSV file as input to SSIS package

I receive several CSV files each quarter to process through an SSIS package, and the formatting is inconsistent. This quarter, I encountered what I term optional text qualifiers--text qualifer of ...
0
votes
1answer
56 views

Should I put the parameters in constructor or in method? (Python 3)

I have the following code: def __init__(self, vocable_file_path, xsd_file_path, word_list_file_path): self.vocable_file_path = vocable_file_path self.xsd_file_path = xsd_file_path ...
1
vote
2answers
98 views

Is there a better pattern than multiple inheritance here?

I'm working on a server implementation for a large game with many gametypes. There are several kinds of interactable entities: players, monsters, objects, vehicles. All entities share the same base ...
-2
votes
0answers
21 views

Rpy2 - install and configure it [closed]

I dowloaded the zip file rpy2. I'd like to use some function of R statistic in python. How can we install and configure it, in order to import it in a file or module of python please? Thank you for ...
5
votes
1answer
1k views

Good practices for packaging Python programs

I've been using Python for a while now, both in the context of personal and professional projects. One thing that occured to me recently is that I had never thought about a good way to deploy Python ...
2
votes
1answer
342 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
votes
0answers
60 views

Database design in Python? [closed]

I need to design a teaching staff timetable database. The times for all subjects are fixed: my job is to assign staff to classes. There are plenty of database modules and staffing apps available, ...
2
votes
1answer
35 views

log method calls per object

How to log method calls on a per object basis for a particular class? I.e. after instanciating a = myClass() I somehow want to keep a log for what methods have been called on a like a.reverse() ...
-4
votes
1answer
26 views

Python: Find pattern of repeating number in an array [closed]

so i've tried to make a program that finds a repeating digit in an array of numbers. So after a bit of trial and error i've realized i don't even really know where to start. ...
2
votes
2answers
97 views

Final steps of wrapping up a Python script into a program

I finished building a Python script containing eight functions which download files, extracts them, manipulate and analyze their data and then produce graphs and export them into PNG files. The ...
0
votes
0answers
51 views

Can I listen on a port without interrupting traffic?

I have developed the bare bones on a socket server in Python. I'm trying to capture the HTTP packets going to a web server without blocking them. try: self.socket = ...
-1
votes
0answers
9 views

Python seeming to incorrectly handle time zone conversions [migrated]

I am confused by the following behaviour in a python program I am writing to convert dates and times. I have data in raw `wall clock time' as New Zealand Standard time, and want to convert it so that ...
-3
votes
0answers
15 views

i'm getting this error in python<__main__.Node object at 0x03A5F990> linked list [migrated]

linked list implementation using python class Node: def __init__(self,data,next): self.data = data self.next = next class List: head=None ...
-2
votes
1answer
31 views

Move file into apropriate directory based upon first letter of second word, followed by the first two letters of the second word with Python [closed]

EDIT: Apparently the below question is too specific. Let me rephrase: I'm looking for a way to fit a letter into a list of specified ranges such that, if given the letter S and the ranges A-F, G-M, ...
0
votes
1answer
50 views

Multiple different versions of similar apps in one project

I need some help to improve the architecture of a site I've built. What I want to achieve within a single Django project is the following: I want a site that comes in several versions (one per ...
1
vote
2answers
83 views

Efficient way to handle foreign keys

I am building a script that checks a large network of sites for invalid links. The idea is to flag links that continuously show as not available so that they can be cleaned by the administration team. ...
0
votes
1answer
56 views

Programming to multiple backends

My current project is a high-level abstraction package for GPIO programming on those nifty little SoC-Computers (Raspberry Pi, Cubieboard, Beaglebone Black, Pandaboard etc.). One of my goals is to ...
1
vote
1answer
68 views

When should I use a generator and when a list in Python? [duplicate]

I often find it cleaner to write a generator than to return a list. For example, I prefer def my_func_gen(foo): for i in foo: # Do some stuff that's too complicated for a list or ...
-1
votes
2answers
68 views

Will statically typed, compiled programming languages be affected by Microservices Architecture? [closed]

Judging based on my experience, as systems grow bigger, statically typed languages like Java or C# tend to be more reliable and easier to manage. But do we need all the advantages of such languages ...
0
votes
1answer
72 views

Making API calls with celery

I'm designing a system for a client where the requirements are: they upload a JSON file (one object/line) make a call to an API with the JSON object as the payload record the state (success/failure) ...
2
votes
1answer
33 views

Module level logger function

I've recently been assigned to a new project because I'm one of the only developers at my company who has used Python extensively in the past. My first task was to clean up the code base and make it ...
4
votes
2answers
5k views

What is the way to go to extract data from websites? [closed]

I've been thinking about a side project that envolves web data scraping. Ok, I read the Getting data from a webpage in a stable and efficient way question and the discussion gave me some insights. ...
4
votes
3answers
1k 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. As you know, Django app contains two main directories for front-end: /static - for ...
2
votes
2answers
90 views

Is the function using python list comprehension, stateless?

Below is the function count_leaf, that appends mutable list branch_counts, which is not stateless. def count_leaf(tree): if is_leaf(tree): return 1 branch_counts = list() for b in ...
1
vote
1answer
38 views

Is async keyword an ultimate replacement for asyncio module?

Recently, there was a rise of interest toward asynchronous programming in Python community. First prominent expression of this interest was the appearance of Asyncio —codenamed Tulip— framework [PEP ...
3
votes
1answer
169 views

Draw a Call Graph

I'm maintaining an old code base written in python. In particular there is a complex piece of code that from a module calls other functions from other modules that call other functions and so on. It ...
0
votes
1answer
102 views

Python object oriented programming problems while implementing binary search tree

I am shifting from procedural C programming to OOP Python programming and I faced some problems while implementing binary search trees. I cannot make my Tree_Node null in case of deleting it. In C I ...
0
votes
0answers
15 views

Making list of adjacent node pairs from Cube-formatted line file (using Python) [migrated]

My files are formatted like this: LINE NAME="FirstLine", MODE=15, ONEWAY=T, HEADWAY[1]=20, HEADWAY[2]=30, HEADWAY[3]=20, HEADWAY[4]=30, HEADWAY[5]=30, VEHICLETYPE=2, XYSPEED=20, N=-20609, ...