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)

0
votes
0answers
8 views

Web app with a Node.js front end interefacing with a python script with sockets

Right now I have a webpage with various buttons and options that I'd like to use to send commands to a python script running on the webserver. The python script is being used to interface with devices ...
0
votes
2answers
68 views

Why python doesn't provide optional types?

I've recently used typescript, and I think the ability to mention or not types is great. It greatly reduces the debugging time while also giving you the advantages of an untyped language. I could ...
-3
votes
0answers
12 views

Syntax error at second definition in Python [migrated]

def specificChecker(someThing, checker): if checker == None: return someThing elif checker == True: return not someThing else: return None def ...
-2
votes
0answers
34 views

multiprocessing in Python does not work the way I thought

The project is about comparing strings from a large text file, I wrote a for loop to do the comparison, this part was done without any problem. In order to increase efficiency, our professor asks us ...
0
votes
0answers
33 views

Download latest Excel files from a website regularly

First, I'll try and describe my problem, then I'll explain how I am trying to get around it. Problem: I regularly download excel files from the internet, this occurs every three months. There's a ...
-2
votes
0answers
55 views

Python web crawler [on hold]

I wrote a python web crawler #!/usr/bin/python import threading import urllib import Queue from bs4 import BeautifulSoup import sys import time import signal visited_urls = [] crawl_lock = ...
1
vote
1answer
40 views

How do I organize my project to accomodate GIT pull requests for source installed via PIP?

I want to structure my Python project in a manner such that others can use a package manager (PIP) to easily clone the environment for team development, and GIT to contribute to the project, plus a ...
1
vote
1answer
48 views

When to have a generic method for multiple tasks when some differ?

I process a lot of tweets in real time using python and for each tweet I need to assign it in to a specific bucket. I have about 50 buckets, each with their own rules. The majority of them are simple ...
-1
votes
0answers
20 views

logging another device using exscript PYTHON from already logged into device

I am using Python's Exscript module to log onto network device (Juniper/Cisco), once in I fetch vrf details and use same to log onto another device which is basically a SWITCH. I am stuck how to I ...
0
votes
0answers
34 views

Why do I get a memory error using .next()? [migrated]

I'm trying to parse a text file in python 2.7. The file has has around 10^11 lines so I can't load it into memory. This works just fine: with open('file_name.txt') as f: for row in f: ...
1
vote
0answers
85 views

How random are these numbers?

I am making a script for creating true random numbers. I use APIs from RANDOM.ORG and ANU QRNG. The method I have is I get a number from one of the sites and use it as a seed in the Mersenne Twister ...
-2
votes
1answer
75 views

Design pattern options for a web framework [on hold]

I'm currently working on a Python web socket server framework to develop new services easily. I'm not the original developer of the project and I think the design could be improved, so I'm asking ...
-1
votes
0answers
26 views

Python public package development environments

I have a package on my computer I use for personal, general use code. I build it with python setup.py develop --user which works very well for making changes to the code and it taking effect without ...
0
votes
1answer
95 views

`var is None` vs `var == None`

I often see var is None in python code, using is to test equality only works for a very few objects like None. I used to think that it's better practice to use == to compare equality even if is is ...
4
votes
2answers
209 views

What makes a scientific programming language, scientific?

Why are some programming languages such as Python or Julia considered to be "scientific" programming languages? I guess my real question what is the criteria that makes a programming language ...
1
vote
4answers
472 views

Why use a higher level language? [closed]

A question that gets asked a lot is "Why use low level languages if you can code in high level languages more easily (and often tersely)?". I think the answers are fairly straight forward here, being ...
0
votes
1answer
38 views

How can I integrate Python into an OSX program?

I'm very comfortable with Swift, Obj-C, and Javascript but for a new project I need to use a library that is only available in Python. How do I integrate python or python scripts into an OSX project? ...
1
vote
0answers
37 views

Facebook Login vs Python Social Auth (or django-allauth, etc.)

Background: I'm creating a mobile app using an API built with Django using Django REST Framework and hosted on Heroku. In the past, I've used Python Social Auth with this setup to authenticate users ...
-2
votes
0answers
41 views

What are Python .pyc files and how can one use them in django project and is there any way to open them? [on hold]

.pyc contain Python bytecode for .py file(Please make a correction if i am wrong here). I have gone through this link.. < http://www.network-theory.co.uk/docs/pytut/CompiledPythonfiles.html>
1
vote
1answer
42 views

Editing Python libraries

I have been using python for a fairly long time and now I want to modify a python library to fit my needs. There are two ways to do this as far as I know. One is to modify the source code itself. ...
-2
votes
0answers
23 views

Convention for naming filename, path, etc in python [on hold]

I'm currently using this convention file : a file object obtained with open() name : name of a file/folder without path (ex : myfile.txt) filename : name of a file with it's path (ex : /var/projects/...
-1
votes
0answers
22 views

How to set the limits on a color bar - python Mayavi?

I am using Mayavi to create 3D visualizations of data I am producing with another code. Eventually, I would like to be able to string together all the images created with Mayavi to produce a movie. I ...
0
votes
0answers
31 views

Optimal Simplification of Transposition Products

I am looking to take a product of a large number of transpositions, and boil it down to a smaller number of products. I have the following code, and would like some input on efficient ways to boil ...
0
votes
1answer
82 views

Dependency Injection (DI) and Dependency Inversion Principle (DIP) for built-in functions and external libraries

Question I apologize if this question has already been posted. I tried searching but I couldn't find the answer. I often find myself trying to use DI and DIP where I need to open a file or a socket. ...
0
votes
0answers
84 views

Planning dinner seating, having each person sit with as many other people as possible, changing tables between each course

My project is as follows: I am making a program for planning dinner seating that will take a number of courses, a number of tables, and a list of people. The goal is to have each person sit with as ...
-3
votes
0answers
22 views

Python Assignment of a Variable By Looping through a Range [migrated]

The first two if statements should be identical... The first one works, the second does not work. What is wrong with the second if statement? row=0 tsig=0 InTrade=[] for data_buy ...
-1
votes
0answers
21 views

problem re-associating .py from Python26 to 27 on Windows 7

I needed to re-associate python .py file from Python26 to Python27 on Windows7. New association now works but at first when I ran test python script it failed. I had to re-run same script 3 or 4 times ...
-1
votes
0answers
44 views

Algorithm for Multiple Choice Test Prep App

I'm working on app that helps students prepare for a specific exam. I have a database of 1000 questions, question categories, multiple choice options, hints and correct answers. Today, the app simply ...
0
votes
2answers
66 views

Literals versus instantiating by name lists and dicts in Python?

In Python, what is the difference in these declarations… my_list = [] my_list = list() …and in these? my_dict = {} my_dict = dict() Are they interpreted the same, and why would you use one over ...
0
votes
0answers
20 views

Difference between RAISE and RETURN HTTPResponse in bottle framwork

I am using Bottle framework to implement API's. There is code return before I started, and they use from bottle import HTTPResponse @api.get('/some/api/url') def some_method(...): ... ... ...
1
vote
2answers
190 views

Python build system

Currently our Python application is deployed like this: Development team work on issues, commit code and create a Pull request Pull request is integrated to Development branch QA and Operations team ...
3
votes
1answer
47 views

Importing large data sets into a database over the web

I need to import 100,000 products from one database to another using the results from a RESTful API. But I can only do this overnight. So if I can't get the job done in one day, I need to spread it ...
0
votes
1answer
47 views

Most Pythonic way to remove first match of potential leading strings?

This is a bit difficult to describe, but I'll do my best. In Python, I can use string.startswith(tuple) to test for multiple matches. But startswith only returns a boolean answer, whether or not it ...
5
votes
3answers
80 views

How do I scale up a bot/service?

I have this bot that I've created for Twitter. It's written in Python. It lives on my Raspberry Pi and I've set up a cronjob to run it every 60 seconds. Part 2 of the project is to build a web app ...
1
vote
1answer
112 views

Is using __import__('module_name') an antipattern in Python?

I'm currently refactoring a Python 2 project which includes the ability to add or remove plugins, which are Python modules implementing a given API. The main app accesses add/remove/update hooks in ...
0
votes
0answers
42 views

Modeling a cookbook recipe with django

I'm trying to model recipes in a cookbook. Here's what I have so far: class Recipe(models.Model): title = models.CharField(max_length=255) class Ingredient(models.Model): class Meta: ...
-1
votes
2answers
104 views

How to write code for different versions of linux

So, I've written some fairly big code for cent OS 7.1. The code essentially makes use of different command line tools by parsing the text output and shoving it in a database... pretty straight forward....
-3
votes
1answer
80 views

Which license should I choose so I can open source my Botnet and not get sued?

I have been working on a Botnet for a high school project in Python and would like to open source it and share it on GitHub without getting sued. I need help with choosing a license such that I am ...
1
vote
1answer
48 views

Best structuring for IRC message decoding (Python)

I am writing a simple IRC chatbot in Python and, in an effort to get more into OOP, made a basic "connection" class that manages all the backing-and-forthing involved. But IRC protocol is rather ...
0
votes
0answers
41 views

Dynamic programming vs branch-and-bound for the knapsack problem

I have to implement a program that solves the 0-1 knapsack problem, where the weights and values of all items are nonnegative integers. We went over two methods in class: dynamic algorithms (...
1
vote
1answer
158 views

Is calling the superclass constructor in a subclass really important?

The following piece of Python code uses a superclass solely as the repository of functions that one of more subclasses may draw from: class Class(object): ''' A trivial repository for functions to be ...
-2
votes
2answers
120 views

Are there coding standards for whether procedural programs should have source code listed top-down or bottom-up? [closed]

Let's say I have a basic procedural program which is well structured into decomposed functions. For example, a main() function which calls functions a and b, which in turn each call functions c and d, ...