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)

-5
votes
0answers
40 views

What language is this? [on hold]

import bz2,struct,os,stat from cStringIO import StringIO sfai=file('dfdata.sfai','rb') h=struct.unpack('128L',sfai.read(0x200)) assert h[0]==0x49414653 # "SFAI" start=h[6] size=h[7] print "INDEX: ...
-1
votes
0answers
22 views

How to use python sockets with proxies [on hold]

I am looking for a way to connect to my local Minecraft Classic Server using Python, but thru proxy. Are there any Python modules to do so? P. S. Right now I am trying SocksiPy. Hope it will work.
-1
votes
0answers
53 views

Should I stick with flask or port to Django? [on hold]

I started my project with flask and mongodb for the purposes of rapid prototyping. I love flask/mongodb and have been successful with it so far. At this point, my application is growing in complexity. ...
0
votes
0answers
16 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 = ...
-3
votes
0answers
29 views

python function argument and local variable naming [duplicate]

I am using Python for most of my programming stuff and came across the Google and PEP 8 naming conventions. Basically, both of them suggest to use lowercase_with_underscore for both local variables ...
0
votes
0answers
18 views

Is a WeakValueDictionary appropriate for a pubsub manager?

I find I learn best when I have to start from step 0, and since pubsub has not been an intuitive process for me to grok, I decided to make my life difficult and build a pubsub library for Python. ...
-3
votes
1answer
82 views

PHP or Python for a webservice? [on hold]

I did a REST webservice with Python. As I need to expand it, I'm wondering if Python is really the best choice. My team is working on both PHP and Python. Is one better than the other in terms of ...
-1
votes
3answers
162 views

Finding the name of a video game with a picture of its cover (Python/Java) [on hold]

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 ...
-4
votes
1answer
105 views

Is there a purely technical term for 'monkey patching' [on hold]

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
votes
0answers
17 views

Matlab code convert into Python [migrated]

I have been coding in Matlab for many years, and was recently suggested Python by many people as a future. Being interested I started learning it. I do not want to compare these two and currently am ...
1
vote
1answer
55 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 ...
-4
votes
0answers
76 views

python create sqlite db bad formed [closed]

Ok, i found this code that reads a encrypted file and generates a sqlite file, but when i try to read the generated db with sqlite browser or sqlite manager (a firefox plug in) i'm not able to view ...
10
votes
2answers
400 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 ...
1
vote
0answers
16 views

Laplacian of Gaussian Edge Detector Being Affected by Change of Mask Size [migrated]

For a class, I've written a Laplacian of Gaussian edge detector that works in the following way. Make a Laplacian of Gaussian mask given the variance of the Gaussian the size of the mask Convolve it ...
-2
votes
0answers
56 views

Python application development frameworks and tools [closed]

I am writing an application in Python. This application has a fairly complex GUI and a complex database backend (several database files used during runtime). What I think I should use so far: ...
0
votes
0answers
15 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 ...
-2
votes
0answers
18 views

Using pylint to compute entropy of python code [closed]

I went through couple of articles on computing code entropy. I think with regard to python, pylint does a good job of identifying coding standard issues to start with. Does anybody knows of any work ...
0
votes
0answers
27 views

Python Curses without clearing screen [migrated]

I would like to use Curses under Python without clearing the screen. The reason is that I would like my app to pop up a simple small menu over the existing screen and soon exit. It is acceptable, ...
-3
votes
0answers
51 views

Create a master login web page? [closed]

I want to create a master login page for owncloud,roundcube and phpfox. It means I want to create a simultaneously login page(single) for all softwares at once. That means when you log on with that ...
0
votes
1answer
86 views

DDD - Domain Driven Design, which development order should be applied?

1 - Design my entities, ie (in python): class Account: def __init__(name, author): self.name = name self.email = email 2 - Design my repositories: (as interface) class ...
-2
votes
0answers
24 views

Append a list to a list: AttributeError: 'NoneType' object has no attribute 'append' [migrated]

I want to append a list into another list, but it gives me the error: AttributeError: 'NoneType' object has no attribute 'append' Originally I wanted to append the list to an array, but that also ...
-4
votes
0answers
53 views

Can I get right guidance to enter software development? [closed]

I am beginner in software development As a beginner I know C/C++ not at expertise level But I am liking Python Give me right guidance
0
votes
2answers
121 views

Why does Python use hash table to implement dict, but not Red-Black Tree? [closed]

Why does Python use hash table to implement dict, but not Red-Black Tree? What is the key? Performance?
1
vote
2answers
256 views

Why do concurrect languages tend to have more complicated syntax?

This is a question that's been on my mind for a while. Recently I've been checking out concurrect languages like haskell or Go or erlang. From my POV they have huge benefit in performance as opposed ...
1
vote
1answer
148 views

Python - Is this a bad strategy pattern?

I've got a Python project wherein a basic object is created and various different attributes are modified/given to it via what I thought was a good example of a strategy pattern. In this silly game ...
0
votes
0answers
27 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): ...
1
vote
1answer
53 views

Best way to search through directory structure

I'm working on a python program which organizes a music library. The program will basically help me detect misspelled file or directory names, wrong FLAC tags or unknown/superfluous files. It will ...
-1
votes
2answers
224 views

Utterly Confused with OOP - How do I overcome a beginner's hurdle? [closed]

I have been reading and working through the exercises of Steve Lott's book Building Skills in Python. However, on the very first exercise dealing with OOP I have gotten completely stuck. The problem ...
0
votes
0answers
11 views

How to use python os.walk, but first get the subfolders and then the files as XML file [migrated]

I'm python beginner and started to work on the below script. It already works, but in the wrong way. Now i get stuck and I would like some help. I use os.walk in order to get an index as a XML file of ...
0
votes
1answer
47 views

scipy.stats.percentileofscore() wrong?

i'm a data scientist and python noob, but I seem to have found a bug with scipy.stats.percentileofscore. it may be "by design" but please bear with me. if you have an array, you will get an upper ...
0
votes
2answers
153 views

Python - only one return per method? [duplicate]

I'm trying to sort out whether this is just a personal preference thing or whether it's actually bad practice to do this one way or another. I did try to reference PEP8 first, and I did not see an ...
5
votes
2answers
305 views

Is there a name for the number of values a variable can take? [closed]

For example, a bit or a boolean can be either 0 or 1 so the number 2 is associated with it. Similarly, for a byte which is 8 bits, the maximum number of different assignments would be 2^8. Is there a ...
0
votes
0answers
27 views

Filling in gaps in time interval data (python) [migrated]

I have a program (written by a friend) which takes an input file (attached) and breaks up the time into 100ms intervals and cuts off at the sentence duration time. The problem is, there are gaps in ...
0
votes
3answers
97 views

Isolating unit tests in python

As a 30-year software developer, mostly in OO languages, but a newbie at python, I'm looking to find what is best practise for isolating unit tests in python. Let's say I have the following, ...
3
votes
2answers
167 views

Tablet development for a dedicated system

I need to make an architectural decision for developing (actually porting) my embedded solution on a tablet. The choice comes down to Ubuntu or Android, so I have some specific questions to help me ...
0
votes
0answers
21 views

Why does my host header not work? [migrated]

I am trying to write a man-in-the-middle for a webserver (to add extra services, not for nefarious reasons. I am trying to pass a Host header, since the back-end put's it's address, as taken from the ...
1
vote
1answer
88 views

why is len not a reserved keyword in python

why is functions like len and max not a reserved keyword in python. Following are the only reserved words http://docs.python.org/2/reference/lexical_analysis.html#keywords
1
vote
2answers
101 views

When to use python function nesting?

I am writing a program that creates backup of directories. Which of the following approach is better for code organization? Create separate class for Backup and Zip logic - class BackupUtil: ...
0
votes
0answers
26 views

Adapting Python Code to Extract Mentions from Tweets for Mention Network [migrated]

Background: I found this code from Alex Hanna (https://github.com/alexhanna) and I've been trying to adapt it to my situation, but haven't been as successful as I would like, and was hoping for help. ...
0
votes
1answer
119 views

How to Think like a computer Scientist. Chapter 3, Question 2 [closed]

http://interactivepython.org/runestone/static/thinkcspy/PythonTurtle/helloturtle.html I'm stuck on question 3. Give three attributes of your cellphone object. Give three methods of your cellphone. ...
0
votes
1answer
141 views

Why are Python's package names not creative? [closed]

First, I LOVE Python, and Python is my first programming language. I'm just wondering why Python's packages got kinda ugly unmemorable and sometimes very long names? I find other languages (e.g. ...
0
votes
1answer
26 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. ...
-2
votes
0answers
17 views

Calling thread.timer() more than once.(python) [migrated]

The code: from threading import Timer import time def hello(): print "hello" a=Timer(3,hello,()) a.start() time.sleep(4) a.start() after running this script i get error: "RuntimeError: ...
3
votes
0answers
85 views

Language/OS choices for a low-latency (<5ms) software [closed]

For purpose of an academic research, I need your inputs on implementing the following software so I can give better recommendations to a friend. The software will display images in frequencies ( ...
0
votes
0answers
3 views

Printing out JSON data from Twitter as a CSV? [migrated]

I'm extremely new to Python, and the Twitter API, but I found a example online that walked me through the process. Now that I've been playing around with it for awhile, I've begun to push the limits ...
0
votes
3answers
84 views

Is it possible to have setup and tear down methods run only for specific unittests?

I currently have a test class with a setUp method for creating a temp file and a tearDown method for deleting a temp file. However, only some of the the test_ methods in that class require this ...
0
votes
1answer
121 views

How to develop an algorithm for brute-forcing / backtracking?

As a beginner programmer, I don't know how to conceptually think about brute-forcing. My mind can't really fathom how to write code that will try every possibility. I have a problem that I want to ...
1
vote
3answers
167 views

Global request context - anti-pattern?

I was talking today to a colleague of mine about Python web frameworks and our impressions about them. I told him I think Flask having a global request smells badly and is an anti-pattern. The docs ...
0
votes
0answers
47 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 ...
3
votes
1answer
128 views

Advantages of contracts over assert statements

Today I stumbled upon the python package called PyContracts. However, python has the assert statement which seems to allow you to do exactly those things. What advantages do contracts have over assert ...