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)

-7
votes
0answers
34 views

Is python supposed to run stand alone? [on hold]

I am trying to make a stand alone application. after I wrote a program, I want it to be a stand alone program. But it seems that that's not quite easy. are all other programing language like this? or ...
-3
votes
0answers
17 views

Good code resource to learning database interaction [on hold]

I am currently working on project with MySQL database and I am looking for good practices to working with database in Python. The next problem I have is that I want to start with unit testing ...
-5
votes
0answers
22 views

Python programming - Output issue between each function call [migrated]

def displayChar(d): if d.isalpha(): print(d, "is a str") elif a.isdigit(): if 'float' in str(type(eval(d))): print(d, "is a float") else: ...
3
votes
1answer
58 views

Encapsulating mutable objects with special structure in Python

I am writing a library for working with special types of trees, called Foo trees. A Foo tree has very special structure. There some operations, called bar and baz, which only make sense on Foo trees. ...
-4
votes
0answers
83 views

Now that I understand Object Oriented Programming, how do I persist objects? [on hold]

I have spent much time learning Object Oriented Programming and I'm ready to begin development on a small project. I am using Python and OrientDB with the pyOrient binary driver. (also with an ...
0
votes
3answers
139 views

Python: Are all dictionary comprehensions just more expressive and compact for loops? [on hold]

Recently, to describe dictionary comprehensions in Python, I wrote: dictionary comprehension is just a more compact & expressive way of writing the same logic as for loops (performance may ...
-4
votes
0answers
23 views

Printing a dictionary to a CSV file when some keys have more than one value [on hold]

I have a CSV file, from which I am reading some fields (columns) into a dictionary (so that one column serves as a key and other as a value). To be more precise, I have keys in numerical format and ...
5
votes
2answers
87 views

How do I model partial dates in Python? Like an unknown year, or unknown day of the month?

I want to be able to capture facts like Bob was born in 2000 and Bill's birthday is May 7th. In both examples we know only part of the person's birth date. In one case we know only the year; in the ...
4
votes
3answers
87 views

Parent class using methods defined in child

I am working on a large program (more than 10k lines of code). Below is a (hopefully not over-simplified) example of a problem I sometimes face: class MyClass1(object): def func_1(self): ...
0
votes
2answers
95 views

Is it a good idea to install more libraries than you need? [on hold]

I decided to try Anaconda, it seems that too many large companies are using it. I was amazed by the number of libraries included by default installing: python-2.7.9-2 ... installing: ...
1
vote
2answers
75 views

Complex data structure in python: just dict, etc, or some classes?

Consider a web service API that returns a complex Json object. Using the stock Python tools for the job, this will read in from the web service as a dict which contains, in turn, a mixture of arrays, ...
-7
votes
0answers
43 views

How to create a Date object in python? [closed]

I was asked, as an exercise, to build a class in python, named "Date". I have to build few functions according to the requirements. The first one is an "init" model that takes a day, month, year, ...
-1
votes
0answers
17 views

Remove nodes with mouse click, networkX, python 2.7 [closed]

I have written a program in Python 2.7 with networkX which draws a tree for me with black and white nodes. Here is a minimal example: import networkx as nx import matplotlib.pyplot as plt import ...
-3
votes
0answers
46 views

C++ or Python: Best investment for a Medic/Software developer who wants to do complex medical image analysis [closed]

I am an intermediate programmer who uses RoR and previously PHP to create web applications to aid my clinical research - I am a radiologist. I am trying to develop some image processing tools to ...
1
vote
0answers
49 views

Tornado Framework's Design Pattern [closed]

I'm working on a article about design patterns for web applications that demand high load and performance. I'm basically trying to compare an event-based web aplication to it's correspondent ...
0
votes
2answers
30 views

Python packages from an operations perspective

As a developer I am used to keep my Python tools updated. Especially packages needed for installing and bundling. Using the most recent releases of pip, virtualenv and setuptools is in my personal ...
-2
votes
0answers
54 views

Is tkinter useful for a new project? [closed]

I need to make a Cross-platform GUI for an Local Intranet for my University. I heard that Tkinter is outdated framework and not frequently updated. Is there is any strong reason to stick with ...
-5
votes
0answers
34 views

Shortcut for accessing curly, square, and circular brackets [closed]

Is there a way using Python, to change the bracket keys ( for parantheses, square and curly ) for more advanced Functionality? More explicitly; instead of using shift-9 for a circular bracket, I want ...
0
votes
2answers
39 views

Testing binary stream

I am building a binary file importer using Python. The specific file structure is defined in a specification. This looks like: File Map Block String, Short Integer, Long Integer, String, Short ...
0
votes
0answers
44 views

How to avoid the redefinition of a function (PEP8 error F811) [migrated]

I have the following code inside a Python function: strings = ('TIRS10', 'TIRS11') if any(string in fields for string in strings): def transform(row): ''' Transform an input row ...
1
vote
1answer
40 views

Python - best way to have interdependant variable in a class

Newbie Python questions: I want to model something that can have a several inter-connected instance variables and if I set one, I want to recalculate the others. Any can be set. E.g. a circle - each ...
0
votes
0answers
7 views

Python: Replace Numpy with new version [migrated]

I'm new to Python. I've installed Python 2.7.9, which comes with Numpy as default. The problem is, current Numpy version is 1.7 but I need to replace it with 1.9 version. I've downloaded Numpy zip ...
4
votes
4answers
321 views

Legitimate cases of having .equals() behaving inconsistently with .compareTo()?

Java documentation says it's "strongly recommended" to have them behaving consistently. But are there legitimate cases of java/c#/python/etc Object.equals() method behaving inconsistently with the ...
3
votes
2answers
106 views

Should static analysis be integrated with code review? [closed]

I want to integrate various static analysis tools, and then add the results as comments on a file within code review tools, such as Stash or Review board. I am exploring the feasibility of writing ...
5
votes
1answer
159 views

Python rectangle packing

I'm working on a project which involves packing multiple rectangles in a larger rectangle(the bounding box). Rectangles can't overlap with each other or with the boundaries of the bounding box. ...
-5
votes
0answers
9 views

Python print function doesn't work [migrated]

I have followed this tutorial. But I do have a small question. I have copied the exact code in de text editor, and I have the exact same settings in Glade. But when I click the refresh button, I dont ...
3
votes
4answers
139 views

Finding the first index in which the element and the index are the same

I am to build a python function that takes a sorted list of numbers and outputs the first index the is equal to the element in its place. It should run on O(log n) which I know how it should be ...
0
votes
1answer
69 views

How to write a suitable recurrence relation for a python function?

I have an exercise in which I am require to build a recursive function that takes a natural number and returns "True" if it is divisible by 3, or "False" otherwise, using the 3-divisibility rule. Then ...
-3
votes
1answer
68 views

Executable File Size Difference Between Python and C [closed]

Does using lower level programming languages have benefit of generating lesser file size when creating an executable, in contrast to using higher level languages for the same algorithm?
0
votes
1answer
65 views

Translation algorithm - combinations to indices

I have a deck of 52 poker cards represented as array of int - [0, 1, ... 51]. There are 2.598.960 possible combinations of 5 cards. I can generate all combinations like this: #id #combination ...
0
votes
1answer
36 views

Making API calls with celery

I'm designing a system for a client where the requirements are: they upload a JSON file (one object/line) make a call to an API with the JSON object as the payload record the state (success/failure) ...
0
votes
3answers
109 views

Why python function programming functions are not collection methods? [duplicate]

In other words, is there a Python design related reason for it to be so? Functions like map, filter, reduce etc. are just plain functions. Is it just a poor design choice (if it is a good one, ...
0
votes
0answers
20 views

Synchronising a set of data against elasticsearch

So I have a situation where I get in a lot of large XML files and I want that data synchronised on elasticsearch. Current way Have index_1 When data is updated create blank index_2 Load all of ...
0
votes
1answer
56 views

Setting up folders and importing modules in Python

I'm building an app to automate some processes that are annoying to do by hand (looking in a file, taking certain information out of a file, building another file with that information). My project ...
-1
votes
1answer
39 views

Python 3 PyPy implementation? [closed]

I would like to use the PyPy Python JIT Implementation using Python 3. However I can only seem to install it using Python 2. Is there even an experimental implementation of PyPy for Python 3 I can try ...
-2
votes
0answers
23 views

How to open a text file as a character matrix in python? [migrated]

I have a .fa file which contains a list of secuences of nucleotids. It is something like this AGCTAGAGAGACTAGACTAGA GATCAGTACATGATCTAGGAT GATAGTACATGGGGGATAGAC I need to somehow open ...
2
votes
0answers
77 views

Draw a Call Graph

I'm maintaining an old code base written in python. In particular there is a complex piece of code that from a module calls other functions from other modules that call other functions and so on. It ...
0
votes
0answers
27 views

Problem with quicksort and python [migrated]

I'm writing a python program that plays poker for a class, and I need to sort a list of five card hands. I have a function called wins(), which takes two hands and returns True if the first one beats ...
1
vote
1answer
74 views

When should one create a new py-function rather than tweaking another one?

Me and a co-developer are arguing when it's wise to cast a new function rather than tweaking another one. By tweaking I mean an option or a hidden check in an existing function. The question could be ...
0
votes
0answers
4 views

How would you search a dictionary and print out entries with same value [migrated]

I've been a little confused on how you would go about this, so what would be a good way to do it. For Example: If I had this as my dictionary dic = [{1:Dog, 2:Cat}{1:Bird, 2:Rat}{1:Turtle, 2:Cat}] ...
0
votes
1answer
49 views

Django urls.py runs only once. Why? How does it call views on next request?

While testing django cashing on our development server, one of our senior asked if is it possible to change the value of caching timeout on urls.py without restarting the http service. On first note, ...
2
votes
1answer
82 views

Python beginner question with Assigning Variables

Coming from C# and now getting my hands dirty with Python. From what I understand, Python is strongly typed: http://stackoverflow.com/questions/11328920/is-python-strongly-typed As stated in the ...
0
votes
0answers
57 views

Matching groups of similar lines on a generic matching algorithm

I have to write a program to search through a file containing lines and find lines that match to a degree of tolerance but are not necessarily the same. So for example the following lines would match: ...
1
vote
0answers
85 views

Calculating uncompressed file size without uncompressing file in zlib

I am writing a python program which parses zip (currently only zlib, using DEFLATE compression) files and verifies the correctness of their headers and data. One of the things I'm trying to achieve is ...
0
votes
0answers
25 views

Common to include pre-built binaries for supporting build tools? [duplicate]

As part of a Visual Basic 6 project, I have created a python script to provide a CLI to building the project/docs. However, I realize that not all developers who will have access to this project will ...
1
vote
3answers
212 views

Check distance between all elements in a list of numbers in O(n*lg(n))

I have an exercise for my algorithms and data structures class, where I basically have to implement a divide and conquer algorithm or function called check_distance to determine whether all numbers in ...
0
votes
0answers
26 views

Is Python Logging in a WSGI application a best practice a production environment?

I am trying to log my webpage access to a database. It is a requirement. It seems to be a difficult thing to do outside of Windows IIS, and I do not wish to use Python with IIS. My options seem to ...
0
votes
0answers
36 views

Extending the interface of existing (python) classes

I use a library with an existing well-defined interface, that I have extended for my purposes. I.e. most classes in that library inherit of one abstract base class class Parent(object): def ...
3
votes
1answer
81 views

Structure project based on platform or design?

I have a medium sized project (~10,000 lines) that runs on Windows and Linux. However it is only specific components of the program that are platform dependent and are located in a folder called ...
1
vote
1answer
129 views

What is ## used for?

I have looked at other questions about this and the general consensus seems to be that ## is used for commenting out code. However, in the Interactive Editor for Python, prefixing a line with ## ...