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
votes
0answers
9 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
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 ...
0
votes
0answers
43 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
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
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 ...
-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?
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 ...
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 ...
-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 ...
-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. ...
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
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 ...
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 ...
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 ...
-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, ...
-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, ...
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
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 ...
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 ...
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 ...
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, ...
0
votes
2answers
130 views

Nested functions; allow or not? [closed]

Having programmed a whole lot in python, using nested functions is a good way to not clutter the namespace with small helper functions that are only used once. Now I'm programming in go, and upon ...
1
vote
2answers
37 views

Compiling vs pre-built binaries on production machine?

I referred Compiling vs using pre-built binaries performance?. The post talks about performance and opportunities for optimization. My question is about reliability. I built both python and ...
3
votes
3answers
258 views

Why does Python need both a compiler and an interpreter?

I can understand the fact that Java needs both a compiler and an interpreter. It compiles source code to bytecode and then a virtual machine (on Windows, on Linux, on Android, etc.) translates that ...
1
vote
0answers
7 views

Python, Service dies but PID remains.. Log file updates every minute [migrated]

I have service that as the topic says dies and leave a stale PID behind. This particular service logs every minute. So basically I want to create a python script to check the logfile based on modified ...
3
votes
1answer
62 views

What is more pythonic - subclassing dict or creating external functions to manipulate them?

Say I have a dictionary that contains complex classes that need to be loaded and unloaded in a special way. (Not especially special, just outside the bounds of this question.) Should I gracefully ...
3
votes
3answers
231 views

Can you do iterative development in c#? [closed]

I'm primarily a Python/R developer. In those languages, the way I develop is to sketch out a data and class structure, write the methods and their tests in interactive mode, then refactor them up into ...
1
vote
0answers
16 views

save custom ui in pyside (Qt bindings for python) [closed]

I've build a PySide app in which the user can create as many tabs as he wants, each tab can be divided in as many panels as the user wants using spliters, and each subpanel can have a custom widget ...
1
vote
1answer
52 views

Function name in parentheses after fuction call in Python

I ran into these lines of code in the QPYTHON Android app. They are part of a sample that uses the Bottle module to create a simple Web server that seems to work fine. app = Bottle() app.route('/', ...
0
votes
0answers
24 views

Accessing data in widget

Background I started to get involved in a project written in python and wxPython (for the GUI). My task is to debug and add a few features to the GUI. The widgets are organised mainly with sizers, ...
0
votes
0answers
39 views

Utilizing Python Slate for pdf text extraction from PHP

I want to use Python Slate module for PDF text extraction, and I have my code up and running for this. What I would like to know here is how to link my existing PHP MVC to utilize/make a request to ...
2
votes
1answer
257 views

What design patterns could be used here?

I'm trying to come up with a nice design (preferably pythonic) for the following use case. Say there's three services - A, B, C in multiple locations L1, L2, L3, etc. Each service provides ...
-2
votes
0answers
10 views

Extending a list with concatenated values [migrated]

I'm building a list of tweets using tweepy based on: results = [] for tweet in tweepy.Cursor(api.search, q='some term').items(10): results.extend([tweet.id, tweet.text, tweet.created_at]) I ...
-1
votes
1answer
62 views

execute selection in console in C++ like python or R language [closed]

I am started to learn C++ using as IDLE Clion of jetbrain company. Normally using the IDLE of Python (i.e., Pycharm of Jetbrain) or R project i am able to execute selection in console line-by-line my ...