Python is a dynamically typed, high-level interpreted programming 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 and exceptions, and has an extensive standard module library. ...

learn more… | top users | synonyms (1)

0
votes
0answers
20 views

Is there a cross-platform way to execute a Python3 script fullscreen?

I'm currently developing a small CLI game in Python for practice. While I can set the shell width and height quite easily, there are lots of different screen sizes in use right now, and I would like ...
-1
votes
0answers
29 views

Do I have to learn some actual Python to use Tkinter

I am learning Python to build some Desktop Applications. I am wondering if I have to learn most of Python before using Tkinter with Python for GUI based applications.
0
votes
3answers
205 views

When NOT to use a class / member variable?

I am trying to learn WHEN NOT to use: classes member variables HERE IS THE CODE access_point_detection_classes.py from scapy.all import * class Handler : def __init__(self) : ...
0
votes
2answers
49 views

Object Oriented Python methods and their parameters

Let's say I have a class MyClass ... which has a data member x class MyClass1 : def __init__(self) : self.x = 1 Also a method which does something with x Should I pass self.x as a ...
-2
votes
1answer
56 views

Do .pyc files in Python contain mnemonics

I'm interested for some time in CPython implementation of Python. I understand that .pyc files contain serialized bytecode, including opcodes. However do these files contain mnemonics? I think that ...
-3
votes
0answers
20 views

Minimum value of a node in a binary search tree

I am making a program that returns the minimum value of a binary search tree recursively and I don't know how to implement it. I am stucked here, please help def bst_min(t): if t.is_leaf == True: ...
-1
votes
0answers
43 views

Big web application on python [closed]

I am experienced PHP developer. I am pretty familiar with tools in this language. I know, that for big complex application I'd use symfony or zend framework. On the other hand, for some kind of REST-...
0
votes
0answers
36 views

Inaccurate fractional exponentiation / accurate fractional exponentiation in Python? [duplicate]

In Python, 9 ** 3 obviously is 729; why is 729 ** (1 / 3) 8.999999999999998? 9 == 8.999999999999998 gives False. Is this problem solvable?
-2
votes
0answers
19 views

Need some help with making Selenium to click on a button [Python] [closed]

<input class="button" value="Log in" tabindex="104" title="Enter your username and password in the boxes provided to login, or click the 'register' button to create a profile for yourself." ...
0
votes
0answers
19 views

Developing Python Scripting API using Petrel Ocean SDK (C#/.NET)

I use a commercial software called Petrel. Petrel has a software development kit (SDK) that allows the user to develop plugins in C#/.NET via the Ocean core API. At our offices, we have installed a ...
-2
votes
2answers
36 views

Using Python to start up multiple programs simultaneously

I am attempting to write a python script that with remove some of the tedium of my everyday actions. Specifically, I always need to run Eclipse, Java VisualVM, and a docker container. I had planned ...
-2
votes
0answers
36 views

Requesting feedback on my python code: [closed]

I'm a teacher in a school which is offering computer science next year. I'm relatively new to the subject myself and currently in the process of up skilling . I have written a program in pythons which ...
-3
votes
0answers
48 views

Develop a python project from 2 different operating systems on the same machine? [closed]

Can I work on a python project from 2 different operating systems on the same machine? I have a python 2.7 project I am developing with a virtualenv that lives on my HDD (with win7) that I have as a ...
0
votes
0answers
30 views

Store as much code as possible in single folder to allow easier upgrading

I have a rather large Python code with a structure that looks like this: my_code.py +-- packages/ |-- __init__.py +-- pack1/ |-- modu_11.py |-- modu_12.py +-- ...
4
votes
1answer
47 views

How to redistribute modified code under PSF license

I spent a few hours cleaning up a really old Python library, ProxyTypes. Two days from now will mark 10 years since it was updated. Today, I updated it to support the newer Python 3, and to be ...
0
votes
2answers
77 views

Building a personal C/Python library to replace Matlab [closed]

I am considering to switch from Matlab to Python/C++ for research work. The objective is to create an environment similar to Matlab for rapid prototyping. Python is slow even with numpy and schipy. ...
-1
votes
0answers
13 views

Application made in python and compiled with py2exe didn't work [migrated]

I made a python 2.7 program in PyCharm called Intelligent Timer. It is working and showing the stopwatch Changing time in both PyCharm and python IDLE. But when I converted it to .exe file using ...
-4
votes
0answers
61 views

Extensible python project layout

I am developing a bot for a game I'm playing and i am having quite a debate as how should i structure my code. I designed my bot to be extensible, everyone can develop a module to farm something the ...
2
votes
5answers
72 views

How do I systematically evaluate the performance of my Python script?

How do I know if my code is running fast enough? Is there a measurable way to test the speed & performance of my code? For example, I have script that is reading CSV files and writing new CSV ...
-4
votes
1answer
33 views

How do I get python to recognize my DLL file as import(able)

I ran into an error stating: "ImportError: No module named 'pywintypes'", and after some reading around, I have discovered that the DLL for pywintypes is in C:\Python35-32\Lib\site-packages\...
1
vote
1answer
90 views

Making a member function treat two objects differently in Python

I have in my program a class with a member function that should treat certain objects slightly differently than others. In order to do this, it needs to know which object was passed to it, because ...
2
votes
1answer
31 views

Variables (scalars and matrices) assignment in Python

Here are the two cases under consideration. (a)Scalars and (b) Numpy matrices. My query is about initialization and assignment. 1 Perfect y = x = 0; x = 7 print(x,y) y = 8 print(x,y) x=10 ...
0
votes
1answer
52 views

Should I always use prefix private methods with an underscore in Python?

Prefixing methods and members with an underscore indicates internal use. For simple classes, I sometimes find the easier reading and typing of self.foo outweighing the indent of self._foo. Especially ...
4
votes
1answer
51 views

Reraising exception explicitly or passing it on?

This question is about coding style. Say I have a function, f. f depends on a condition C. It calls another function g as a subroutine. g also depends on condition C. If it finds condition C is not ...
0
votes
1answer
72 views

Designing a RESTful API for a file manager

I am building a file manager web UI (front end ReactJS, back end Flask). RESTful API seems to be very suitable in this situation at first sight, but I get into trouble. I need API contain: List ...
0
votes
1answer
50 views

How to distinguish the two types of Python “packages”

In the Python ecosystem, there are two related but distinct concepts called "package": A "dotted module name", represented in its source as a directory with an __init__ module (i.e. an __init__.py ...
0
votes
0answers
38 views

Abstracting remote API efficiently in Python

I have to replace SQLAlchemy "table" (declarative) class with mostly functionally equivalent wrapper, which will use API of another microservice. All the usages can be edited, so there is no need to ...
1
vote
1answer
22 views

Python Base class for instantiating API query module

So I am writing a datamodel in python that interacts with an python module that queries the api. class QueryAPI(): def __init__(self, clientid, clientsecret): self.clientid = clientid ...
0
votes
3answers
110 views

Can I easily parallelize this script?

I have a script that compares in some way each line from file1 and file2, and outputs the lines if there is a difference. I want to make it faster - right now it's in Python. I could use threads, but ...
1
vote
0answers
43 views

Argparse - explicit vs implicit, simple vs complex

Given that Explicit is better than implicit. But also Simple is better than complex. I was wondering how accepted it is to transform code like this: import argparse def func(a, b): ...
0
votes
1answer
104 views

What is the best way to publish a REST API so that other people can see and improve/add new methods on it?

I have a requirement to (re)design an existing REST API which is written in Django REST. One of the main requirements is allowing third parties, approved by us, extending of our API. The API is a ...
23
votes
2answers
678 views

What semantic features of Python (and other dynamic languages) contribute to its slowness?

I don't know very well Python. I'm trying to understand more precisely what exact features of dynamic languages (à la Python, Lua, Scheme, Perl, Ruby, ....) are forcing their implementations to be ...
1
vote
1answer
105 views

Should I use this very short Python Quicksort implementation?

def quicksort(N): if len(N) < 2: return N else: less = quicksort([number for number in N[1:] if number < N[0]]) more = quicksort([number for number in N[1:] if ...
0
votes
0answers
32 views

Guessing HTML vs Plain Text and Entity Reference Character in HTML [migrated]

Input supplied as Text # Python 2.7 >>> bs4.BeautifulSoup("H&W Insurance") <html><body><p>H&amp;W Insurance</p></body></html> # Python 3.5.2 >&...
3
votes
1answer
80 views

Do I lose the copyleft protections of GPLv3 when I publish my code on PyPI?

I created a Python package and licensed it under GPLv3. When I created an account on PyPI, I had to agree to the following: The PSF is free to use or disseminate any content that I upload on an ...
0
votes
1answer
49 views

Is there a way to control a looping Python script with Heroku?

I have a Python script that continuously makes GET and POST requests to a third-party API at about 1 request per second. It uses a while loop, so the requests all come from the same process. Currently,...
0
votes
1answer
43 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 ...
-1
votes
2answers
100 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 ...
1
vote
1answer
53 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
58 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 ...
0
votes
0answers
95 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
2answers
188 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 ...
3
votes
2answers
236 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 ...
0
votes
4answers
508 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 ...
1
vote
1answer
63 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
97 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 ...
1
vote
1answer
60 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. ...
1
vote
0answers
38 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
85 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. ...