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)

1
vote
0answers
83 views

Developing code editor with python and gtk

I'd like to start writing a code editor for Python / PHP using python and gtk library but I need some advice before I start: In a general way, how is best to do syntax highlight? I was viewing the ...
0
votes
3answers
50 views

If an object should be flagged, should it be built with the flag attribute?

Let us assume I have a basic object with a handful of self-relevant points of data. class A(object): def __init__(self, x, y, width, length): self.x = x self.y = x ...
-2
votes
2answers
85 views

RESTful API development : is it web developer's work or software developer's work? [closed]

First of all, I am sorry that the issue I'm going to say is not about a technical thing. I'm just confused. I am trying applying to several companies as a software engineer. The latest work that I ...
0
votes
0answers
26 views

Choosing a database for a framework with both asynchronous and synchronous calls

I'm building a framework to work as an all-purpose astronomy pipeline and before I get too far into development I was hoping to run my needs by you all to see if there are any optimizations or ...
1
vote
1answer
81 views

Logging in a distributed system

We have several application servers (and different applications) running on Amazon AWS and our main method of logging is a combination of statsd, carbon/graphite, and an alert system based off of the ...
1
vote
1answer
146 views

Pythonic version of Java interfaces

I fully acknowledge that Python and Java are different programming languages and should be used differently. That said, "Program to an interface, not to an implementation" is good language-agnostic ...
1
vote
2answers
92 views

Usage of __ while declaring any variables or class member in python

Is it good practice to use __ convention while declaring the member variable? This also imparts private kind of feature of that data member. There have been cases when I found that its good to have ...
0
votes
0answers
27 views

HTTP API that wraps any Python-Scrapy spider

I have to write an HTTP API that wraps any Scrapy spider, it should accept Requests, execute them in Scrapy, and return data extracted by the spider and lets the user reuse the same code to extract ...
1
vote
2answers
80 views

Learning python functions and parameters

def printMax(a, b): if a > b: print(a, 'is maximum') elif a == b: print(a, 'is equal to', b) else: print(b, 'is maximum') printMax(3, 4) # directly give literal values x = 5 y = ...
10
votes
9answers
2k views

Is there any difference learning OOP on different programming languages? [closed]

I want to learn OOP. I know Python and I know very little things about OOP. But when I search for "learn OOP" in forums I saw a guy saying that "Python is so new that's why you can't learn OOP on ...
1
vote
1answer
72 views

Why chaining matters (Python & SQLite3)?

Why does cursor = connection.cursor() cursor.execute("... return cursor.fetchall() return the expected non-empty result whereas connection.cursor().execute("... return ...
0
votes
1answer
48 views

does anyone know how to use the PyQt 'uic' module method 'compileUiDir'?

I don't find the docstring to be very clear: def compileUiDir(dir, recurse=False, map=None, **compileUi_args): """compileUiDir(dir, recurse=False, map=None, **compileUi_args) Creates Python ...
1
vote
2answers
62 views

Python sorted iterable set, modifiable during iteration

I am looking for a datastructure to handle cycling through a large number of ordered subroutines, some of which are active, most of which are not. I am thinking I need an implementation of a python ...
0
votes
1answer
56 views

Pythonic design for controlling multiple devices through an I2C bus

I'm writing a piece of software in python that will communicate with a bunch of devices via an I2C bus. Each of these devices are going to need some sort of a module or class to handle the ...
1
vote
1answer
100 views

Dynamic method creation in python

I have a class that will have a number of external methods that will all call the same smaller set of internal methods. So something like: obj.method_one(a, c) and obj.method_two(a, c) where ...
0
votes
1answer
85 views

In python, do we have class encapsulation at the level of the object?

I was bitten by using the is operator when i should have been using ==. Am aware that the former tests for equality of the objects' identities and that the latter tests for equality of the objects' ...
0
votes
1answer
82 views

Using module level declared global “singletons” in python

Ok, I know that using singletons is generally a bad practice, but if I do it (for db connection, logging et al.) am I allowed to go (in respect of clean design) with a module defined variable that is ...
0
votes
2answers
251 views

How to write an optimal LAN messenger software?

I am asking this question as an extension to the following question: https://superuser.com/questions/713409/how-to-message-any-user-on-your-lan I don't think I have a real answer. I found it quite ...
0
votes
0answers
31 views

Implementing FUSE for deduplication

I am new to FUSE and using python-fuse for writing a file system for data deduplication. Let's say, I have a directory named "metadata" and in that directory, there is a file foo and a directory ...
4
votes
1answer
178 views

What is the historical reason why Python uses the double underscore for Class Private members

In python a module private function or variable is named _foo. If it is private to a class it is names __foo, The mechanics behind how these work are different, however that is of little relevance to ...
3
votes
3answers
277 views

Is Python suitable for a statistical modeling application looking over thousands of past events?

I'm currently working on a project with a partner where we analyze large datasets of past sporting events. There are approximately 30,000 events per year and we have historical data for five years. ...
5
votes
4answers
336 views

Communicate to a junior developer about bad style

I have a friend who's managed to pick up comma first (best case might be made here: http://ajaxian.com/archives/is-there-something-to-the-crazy-comma-first-style) but it's 100% against our org's style ...
2
votes
1answer
633 views

Using python to parse log files? [closed]

My first useful projects as a programmer has been python scripts that parse out relevant information from log files and do some analysis. I've bumped around and found my way to some functional ...
1
vote
1answer
72 views

How to comment on a PEP?

Proposals for new Python features are collected in documents called PEPs (Python Enhancement Proposals). There's a master list at http://www.python.org/dev/peps/ which links to (for example): ...
1
vote
1answer
246 views

Python for a desktop app

I currently have a .NET app that I want to convert to being cross platform, as a growing number of my users want a Mac version. Since this forum doesn't seem to like questions that are "what ...
0
votes
1answer
173 views

Front-end structure of large scale Django project

Few days ago, I started to work in new company. Before me, all front-end and backend code was written by one man (oh my...). As you know, Django app contains two main directories for front-end: ...
0
votes
0answers
112 views

Django web app with websockets

I want to make a web service using Django, but that also has websocket functionality. Having done a bit of reading, this is the tech stack that I'm looking at: --------------------------------- ...
0
votes
2answers
260 views

How can I convince my client that the task was complex and the time I took is fair?

I am the single programmer working on a website handling both frontend and backend. Recently in my task list I have to provide a social news feed (activities among friends) which should summarize ...
0
votes
1answer
102 views

return Trivial booleans?

I am writing a simple piece of code. Its a function that allowed the user to withdraw some money. There are some restrictions to this though. The user can't withdraw more than the given withdraw ...
0
votes
0answers
47 views

Distributing Contestant Entries Between Multiple Bins, Is this Knapsack?

I am an algorithm novice and am faced with a rather difficult problem. I working with contest's. There are contestant - individual player entry - contestants can have multiple entries into a ...
1
vote
2answers
204 views

Python - assert vs if & return

I am writing a script that does something to a text file (what it does is irrelevant for my question though). So before I do something to the file I want to check if the file exists. I can do this no ...
2
votes
0answers
41 views

idea mapping with global state [closed]

I need to map ideas to ideas to ideas to ideas (four in total, semantically, and a fifth one-to-one): the state is global it can change over time I'm writing the module from scratch Here's my ...
-3
votes
1answer
159 views

How to create interest in programming despite having basic knowledge? [closed]

I am student of 3rd year IT engineering, and I find myself going nowhere in the field of programming. I know the basics of programming languages like C, C++, Java, Visual Basic, HTML, JAVAScript, CSS ...
0
votes
1answer
124 views

Why can python webapps keep sessions between restart and not java?

I've used both webapp2 + GAE for python and a number of Java/JEE webapp frameworks. The python WSGI framework could keep users logged in while I redeploy the app while none of the Java web framework ...
0
votes
2answers
116 views

What are and how do (data-) types work?

What is a "variable"/data type? How does a compiler / interpreter handle types? My specific concern has to do with the different types in lower and higher level languages. For instance in Python, ...
0
votes
1answer
52 views

Verify 0 or 2+ sub sections in a section

There is a rule in writing: When you break a section into subsections, typically it should have more than one subsection. This goes back to the old high school composition rules: if you have an A. ...
15
votes
8answers
560 views

What are good unit tests to cover the use case of rolling a die?

I'm trying to get to grips with unit testing. Say we have a die which can has a default number of sides equal to 6 (but can be 4, 5 sided etc.): import random class Die(): def __init__(self, ...
0
votes
0answers
84 views

Approach to statically analyze a Python code base

What approach should I use to statically analyze a Python code base? In particular, I am looking for ways to: extract and display the class hierarchy, extract and display class relationships, ...
3
votes
2answers
115 views

Inform caller or just let them deal with exception?

I'm not sure how to proceed in the following situation. say we have a function as so: def runsATask(codes): myDicts = [helperFunc(code) for code in codes] for item in myDicts: # some ...
5
votes
4answers
399 views

Why doesn't Haskell have a 'format' function for string interpolation?

I'm trying to use Shake and I stumbled upon the following problem: there's no easy and convenient way to interpolate a string. I know about Text.Printf — it's not what I'm looking for. The ...
6
votes
3answers
277 views

Python - 'if foo in dict' vs 'try: dict[foo]'

This is less a question about the nature of duck typing and more about staying pythonic, I suppose. First of all - when dealing with dicts, in particular when the structure of the dict is fairly ...
-2
votes
1answer
149 views

Extracting data from log files

I will be extracting certain bits from log files using regular expressions to filter out bit of data. Initially I was going to do this with Python. I later started to think about the fastest way I can ...
2
votes
2answers
105 views

Automated testing of programs with graphical output

I am a lecturer for a post-graduate module where I expect my students to write Python code that replicates examples from the textbook. The project has been running for a couple of years and this year ...
18
votes
3answers
990 views

Why do so many languages treat numbers starting with 0 as octal?

I've read Where are octals useful? and it seems like octals are something that were once upon a time useful. Many languages treat numbers preceding with a 0 as octal, so the literal 010 is actually ...
2
votes
2answers
104 views

Is there a way to efficiently allow a user to upload multiple content at once for e-commerce type sites?

Sellers on large sites like Amazon and Newegg need to provide names, descriptions, and images for their products to be displayed on the e-commerce sites. These sellers could have 10000+ products to ...
1
vote
2answers
126 views

Documenting/defining data structures in Python

What is the preferred way to document the contents of and logic behind dynamically generated data structures in Python? E.g. a dict which contains the mapping of a string to a list of lists of ...
3
votes
2answers
152 views

What are the advantages of dynamically binding a method to class instance?

I came across Instagram's API client written in Python. In their class InstagramAPI, they bind the methods to a function in bind.py. When called, the function returns an instance of the class ...
0
votes
5answers
273 views

How to create a Python interview question to write a method

If I'm giving an interview coding question in Java, I can specify the most of the question just by giving a method signature. (Made-up example follows.) public class Table { public String ...
0
votes
0answers
85 views

Extending user registration in Django site that uses both site admin tables and my own module?

I'm writing a Django site that registers a particular type of user and this is done by the resources that come with the framework, the site administration. The issue: I'd like to create a new model ...
3
votes
3answers
146 views

conditional expressions, correct usage

I've recently become quite taken with conditional expressions in Python. Apparently some people consider it unpythonic and whether or not conditional/ternary expressions are even A Good Thing seems to ...