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

Tablet development for a dedicated system

I need to make an architectural decision for developing (actually porting) my embedded solution on a tablet. The choice comes down to Ubuntu or Android, so I have some specific questions to help me ...
0
votes
3answers
127 views

Is it possible to have setup and tear down methods run only for specific unittests?

I currently have a test class with a setUp method for creating a temp file and a tearDown method for deleting a temp file. However, only some of the the test_ methods in that class require this ...
0
votes
1answer
90 views

scipy.stats.percentileofscore() wrong?

i'm a data scientist and python noob, but I seem to have found a bug with scipy.stats.percentileofscore. it may be "by design" but please bear with me. if you have an array, you will get an upper ...
0
votes
2answers
193 views

Python - only one return per method? [duplicate]

I'm trying to sort out whether this is just a personal preference thing or whether it's actually bad practice to do this one way or another. I did try to reference PEP8 first, and I did not see an ...
5
votes
2answers
320 views

Is there a name for the number of values a variable can take? [closed]

For example, a bit or a boolean can be either 0 or 1 so the number 2 is associated with it. Similarly, for a byte which is 8 bits, the maximum number of different assignments would be 2^8. Is there a ...
0
votes
1answer
147 views

How to Think like a computer Scientist. Chapter 3, Question 2 [closed]

http://interactivepython.org/runestone/static/thinkcspy/PythonTurtle/helloturtle.html I'm stuck on question 3. Give three attributes of your cellphone object. Give three methods of your cellphone. ...
0
votes
3answers
190 views

Isolating unit tests in python

As a 30-year software developer, mostly in OO languages, but a newbie at python, I'm looking to find what is best practise for isolating unit tests in python. Let's say I have the following, ...
2
votes
1answer
113 views

why is len not a reserved keyword in python

why is functions like len and max not a reserved keyword in python. Following are the only reserved words http://docs.python.org/2/reference/lexical_analysis.html#keywords
32
votes
16answers
20k views

Why such popularity with Python? [closed]

Other than being annoyed at whitespace as syntax, I'm not a hater, I just don't get the fascination with Python. I appreciate the poetry of Perl, and have programmed beautiful web services in bash ...
1
vote
1answer
189 views

Why are Python's package names not creative? [closed]

First, I LOVE Python, and Python is my first programming language. I'm just wondering why Python's packages got kinda ugly unmemorable and sometimes very long names? I find other languages (e.g. ...
0
votes
1answer
140 views

Python: Counter for Simultaneous calls of a PHP script?

I'm trying to create a queue processing script that's purpose is to find particular files and apply actions based on specific parameters, with the result being to call a PHP script that serves to ...
0
votes
1answer
204 views

How to develop an algorithm for brute-forcing / backtracking?

As a beginner programmer, I don't know how to conceptually think about brute-forcing. My mind can't really fathom how to write code that will try every possibility. I have a problem that I want to ...
2
votes
3answers
321 views

Global request context - anti-pattern?

I was talking today to a colleague of mine about Python web frameworks and our impressions about them. I told him I think Flask having a global request smells badly and is an anti-pattern. The docs ...
0
votes
0answers
67 views

Check some value between each function call

Can you recommend a nice way of checking a particular value between calls to a set of functions? E.g. something like this in Python (might not be terribly 'Pythonic'): self.error_code = 0 # this ...
7
votes
2answers
2k views

Is it conventional to raise a NotImplementedError for methods whose implementation is pending, but not planned to be abstract?

I like to raise a NotImplementedError for any method that I want to implement, but where I haven't gotten around to doing it yet. I might already have a partial implementation, but prepend it with ...
1
vote
3answers
190 views

Python methods vs builtin functions

Python widely uses built-ins (or module function) and not class methods. So len([]) instead of [].length() filter(f, []) instead of [].filter(f) str(2) instead of 2.to_str same for map, foreach etc ...
0
votes
5answers
5k views

Application Development: Python or Java (or PHP) [closed]

I'm looking to get into application development, such as Facebook or Android apps and games. I am doing this for fun and to learn. Once my skills are to par I would like to have some side income from ...
0
votes
3answers
54 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
115 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
38 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
165 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
1answer
250 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
2answers
176 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
69 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
83 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
102 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
213 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
1answer
92 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 ...
0
votes
1answer
70 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
126 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 ...
9
votes
6answers
3k views

Would Python be too slow for client-side use in Browsers?

I've heard the statement that Python would be too slow to be of any use in browsers. I reckon Javascript is only superior in this aspect because of companies like Google who need it fast (and made it ...
1
vote
2answers
108 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 ...
0
votes
1answer
135 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' ...
4
votes
1answer
270 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
354 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. ...
0
votes
2answers
1k 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 ...
2
votes
1answer
911 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 ...
0
votes
0answers
41 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 ...
5
votes
4answers
393 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 ...
5
votes
1answer
918 views

Splitting documentation between docstrings and sphinx

I'm using a combination of docstrings and Sphinx to document my Python programs. With Sphinx's autodoc, I can write a lot of documentation into the source as docstrings. Is there any standard for ...
1
vote
1answer
303 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
53 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. ...
1
vote
1answer
79 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): ...
0
votes
0answers
263 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
271 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 ...
18
votes
6answers
3k views

Advantage of Learning Lisp for a Python Programmer

I am primarily a Python, Java, C++ programmer, and I've gained a recent interest in functional language. I'm thinking of picking up a LISP dialect: Clojure. Now, I've been working through tutorials ...
0
votes
0answers
87 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, ...
0
votes
1answer
110 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 ...
1
vote
2answers
894 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 ...