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)

3
votes
2answers
51 views

What are the most common - real world - applications of lambdas in Python?

Most tutorials on Python lambdas show examples like the one below. >>> sentence = 'It is raining cats and dogs' >>> words = sentence.split() >>> print words ['It', 'is', ...
0
votes
0answers
9 views

Rpy2 - install and configure it

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 ...
-3
votes
0answers
16 views

Please recommend an IDL/RPC framework that works with Java and Python [on hold]

I'm looking for a framework that supports RPC from Java to Python, where the message format can be defined via a simple IDL. My requirements are: Must be high performance Must support streaming ...
1
vote
0answers
52 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
56 views

Database design in Python? [on hold]

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
20 views

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

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
84 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
42 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 ...
-6
votes
0answers
32 views

snackdown round 1A problem 1 [on hold]

Please see the following problem : https://www.codechef.com/problems/CHEFVOTE My code is receiving WRONG ANSWER every time, although I checked my algorithm as well as my code in python many times. Can ...
-2
votes
1answer
28 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
67 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
67 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
46 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
30 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
33 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
99 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
120 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
247 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
61 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
228 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
15 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
51 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
35 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
254 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
60 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 ...
4
votes
2answers
162 views

Should serialization and deserialization be the responsibility of the class being serialized?

I'm currently in the (re)design phase of several model classes of a C# .NET application. (Model as in M of MVC). The model classes already have plenty of well-designed data, behaviors, and ...
2
votes
1answer
96 views

How do I distinguish derived code from original code?

I'm working on a Python project which extends the functionality of some other python modules. Some are part of the standard Python library and mostly use the PSF License agreement while some are ...
0
votes
1answer
56 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 ...
1
vote
1answer
57 views

Should I automatically install needed modules?

I'm writing a program for my grandpa. Occasionally an update will require a new module that's not installed on his computer. I don't want to have to manually install new modules every time, but he's ...
2
votes
1answer
99 views

Python Classes and Design Questions

What is the best way to design a class to see if an update occurs on a property? I have a whole bunch of classes, and current am going through a re-design of the python package I created. ...
-5
votes
0answers
13 views

Why does next(some_generator_func()) yield a different result from next(a_var), where a_var = some_generator_fun()? [migrated]

Let some_generator_func() be the function: def some_generator_fun(): yield 1 yield 2 Why is it that >>>>next(some_generator_func()) 1 ...
0
votes
0answers
62 views

Will this data mining approach work? Is it a good idea?

I need to extract fields like the document number, date, and invoice amount from a bunch of .csv files, which I believe are referred to as "unstructured text." I have some labeled input files and will ...
-7
votes
3answers
157 views

Why different languages have different syntax? [duplicate]

Different programming language always/most of the time use different syntax. For example take PHP, Java and Python. In Php & Java semicolons are compulsory at the end of the line, yet Python ...
4
votes
3answers
256 views

What's special about “non-blocking” node.js?

In the short chapter, What is Node by McLaughlin, he writes: "Node has no blocks, no threads competing for the same resource (Node is happy to just let things happen however they happen), ...
4
votes
2answers
935 views

Does this code follow duck typing?

The principle of duck typing says that you shouldn't care what type of object you have - just whether or not you can do the required action with your object. For this reason the isinstance keyword ...
0
votes
0answers
27 views

list is editing all values instead of just one [migrated]

snake = [] snake_size = 10 snake.append([display_width / 2, display_height / 2]) snake_dx = 10 snake_dy = 0 #I then declare some more lists in snake in an identical fashion for i in ...
-3
votes
0answers
43 views

set() is the value in a key:value pair?

I'm working on dictionary comprehension for a database so that I can save various database tables as nested dictionaries for easier data manipulation. SQLAlchemy Core has a good tutorial with an ...
2
votes
1answer
53 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
0answers
22 views

Ipython3 development cycle

I am new to python (python3) and am using Ipython3 while writing the code just in my preferred text editor. I am not yet sure what is a good development cycle as I keep getting problems with reloading ...
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
67 views

How do I use a list of int to set the index of another list [closed]

I want to use a list called index with only ints to use it to set the index of another list. index = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26] dictionary = ["a", "b", ...
3
votes
3answers
81 views

How to structure project where a library and application using the library are concurrently developed?

I am planning to develop a new application that will heavily use a library that will be developed from scratch specifically for the application, but made general enough for it to be used for other ...