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)

2
votes
2answers
250 views

How to structure a class in python

I have come to python from C++ (I also know a little Java). I am writing code to exercise a server so I basically use http methods to send a load of requests to the server. As part of my code I ...
2
votes
2answers
166 views

Specifying options “hard coded”, in an interpreted language

In a language like Python or JavaScript (NodeJS), is there anything wrong with defining "the configuration file" as a file which essentially hard-codes the configuration settings? For example: ...
0
votes
1answer
194 views

How to format this line according to PEP 8? [closed]

I'm trying to adhere to PEP 8, with a 78 character limit on the length of my lines. I have the following statement: startTime = time.strptime(request.GET.get('st', (dt.datetime.now() - ...
2
votes
1answer
183 views

Python - Importing modules and visibility

Consider the following code: a.py import os def print_rand(): print os.urandom() And another module: b.py from a import * In this code, I end up with an os variable getting imported from ...
1
vote
2answers
413 views

How can I work on multiple programming languages at same time [duplicate]

It always happen to me that if I leave the stuff for 1-2 months I forget the stuff. 5 months back I had symfony project and I did that. At that time I was very much confident that I can do any ...
3
votes
1answer
191 views

What is the advantage of determining scopes statically and using them dynamically in case of Python?

Firstly let me clarify that I know C and am learning Python. So my OOPS is kind of bad. I was reading the official tutorial and found this Although scopes are determined statically, they are ...
2
votes
1answer
110 views

Ported Functions Licensing

I have found several functions in python 2.7.2 to be very useful and I recreated them in C++ for my own uses. How do I properly give python credit for them? Do I even have to? I never actually looked ...
-1
votes
2answers
208 views

Starting Development with Python [closed]

I'm currently a beginning developer (3 years). I have been mainly doing Web Development for as long as I have been developing. This is my comfort zone when it comes to programming. I like both ...
0
votes
1answer
362 views

Restart button in Python

I am having trouble with python. I am making a text-based adventure game, and I am trying to make a restart function when you die. I am trying to count deaths by doing deaths = deaths + 1 whenever you ...
2
votes
0answers
110 views

How to restructure Python frameworks [duplicate]

I just joined a group of five developers (non-professionals) working on a medium sized Python framework (> 50 modules, > 10.000 lines of code). The project has no documentation whatsoever and there ...
0
votes
1answer
154 views

Can You Use 2 Python Modules Issued Under LGPL and BSD License in a Program?

I'm making a drawing program as my first open-source program merely to get a taste of the open-source community. To make said program, I am using Python 2.7. I'm using the following modules: EasyGUI ...
1
vote
3answers
189 views

What is the best way to store configurations of shell/script code to execute later?

I am working on a tool (Python, may or may not be important) that will allow a user to maintain a configuration file containing arbitrary shell and/or language code to be executed on particular events ...
4
votes
1answer
530 views

How to design a composite pattern in Python?

The concept I'm programming an interface over pygame as a personal project, to make the creation of games easier for me. So far I managed to design an architecture that behaves like this : Objects ...
3
votes
2answers
251 views

What is the most optimal algorithm for counting lines of text in a file?

File > 5Gb, simply with lines like apache access.log. Need to get number of lines. Any constructions like file(filename).read().counter('\n') Would read all of files and it would be very long ...
2
votes
2answers
337 views

Should I split a Python class with many methods into multiple classes?

I have a class that will end up having more than ~30 methods. They all make sense to be part of the same class because they require access to the same data. However, does it make any sense to split ...
2
votes
1answer
193 views

Migrating from python 2 to 3 [closed]

It is easy to find questions asking if one should start with python 2 or python 3, and it is a consensus that python 2 is the way to go as it is has more libraries and thus better supported. Python 3 ...
0
votes
2answers
390 views

Python/Database Website development [closed]

I want to create my own website that would allow me to acess a database in the server and do inserts and lookups in a user friendly way. I am a seasoned user of linux and C/C++, and also have ...
-2
votes
1answer
135 views

Programming A Function in Python [closed]

I am quite new to programming, and was wondering if someone might be able to help me get the following working in python: Define , where we consider x(0)=0, r is always positive and less than m, and ...
5
votes
4answers
600 views

How to familiarize myself with Python

I'm a Python beginner. I started programming with Python 1.5 months back. I downloaded the Python docs and read some parts of the tutorial. I have been programming on codechef.com and solving ...
1
vote
1answer
1k views

Python GUI and MVC - get variable from other module

I am trying to split my code into different layers: GUI, reading the GUI, creating input, calculating the model, interpreting data, creating view, sending the view to the GUI. Somebody told me about ...
0
votes
1answer
264 views

Python — Time complexity of built-in functions versus manually-built functions in finite fields

Generally, I'm wondering about the advantages versus disadvantages of using the built-in arithmetic functions versus rolling your own in Python. Specifically, I'm taking in GF(2) finite field ...
-1
votes
1answer
70 views

Which window to choose? [closed]

I'm making an astronomy observation record application through Python 2.7.5 (using Tkinter). And I want it to have multiple screens. I'm thinking logic like this: if object is clicked: #Go to this ...
2
votes
1answer
141 views

Restrictive routing best practices for Google App Engine with python?

Say I have a simple structure: app = webapp2.WSGIApplication([ (r'/', 'pages.login'), (r'/profile', 'pages.profile'), (r'/dashboard', 'pages.dash'), ], debug=True) Basically all pages ...
3
votes
2answers
238 views

How can I keep current with Python coding style?

I've been using Python since version 2.2. I do pick up new language constructs like for example with statement or dictionary/set comprehensions. However, I've realized that even though I'm being ...
3
votes
2answers
156 views

how to follow python polymorphism standards with math functions

So I am reading up on python in Mark Lutz's wonderful LEARNING PYTHON book. Mark makes a big deal about how part of the python development philosophy is polymorphism and that functions and code should ...
2
votes
1answer
295 views

Nested entities in Google App Engine. Do I do it right?

Trying to make most of the GAE Datastore entities concept, but some doubts drill my head. Say I have the model: class User(ndb.Model): email = ndb.StringProperty(indexed=True) password = ...
4
votes
1answer
428 views

How should I architect a personal schedule manager that runs 24/7? [closed]

I've developed an ADHD management system for myself that's attempting to change multiple habits at once. I know this is counter to conventional wisdom, but I've tried the conventional for years & ...
0
votes
0answers
161 views

Plugin based application with TUI

I am wery newb in Python :) Can anyone share example of application whith co using packages "npyscreen" and "yapsy" ? I hope to see a several plugins from several categories. And in TUI(npyscreen ...
2
votes
2answers
268 views

Executables and Python

I've started learning my first language recently, Python, and I became interested in how it differed from the myriad of other programming languages. I've been able to find most of it out with some ...
7
votes
2answers
247 views

How to share control of links/domains on an open source project with many collaborators?

I'm trying to help the Rebol project re-engineer its web presence now that it is open source as Apache 2 — after nearly two decades of proprietary license! The language's creator currently has ...
1
vote
4answers
315 views

Can I perform a code review although I am very inexperienced? [closed]

I have been teaching myself Python as a first language for 2 years now. So far I have done some online courses (NLP, Design of a Computer Program etc.) and solved some puzzles but never worked with ...
7
votes
1answer
598 views

Duck typing, data validation and assertive programming in Python

About duck typing: Duck typing is aided by habitually not testing for the type of arguments in method and function bodies, relying on documentation, clear code and testing to ensure correct use. ...
7
votes
3answers
752 views

How to sync clocks over networking for game development?

I'm writing a game that has a lot of time based aspects. I use time to help estimate player positions when the network stalls and packets aren't going through (and the time between packet's being ...
3
votes
1answer
81 views

Tests for emptiness vs tests for nothingness

Is there any consensus between languages how tests for emptiness are distinct from tests for noneness? In python the following expression is false: {} is {} However this expression evaluates to True ...
9
votes
3answers
632 views

Python Multiprocessing with Queue vs ZeroMQ IPC

I am busy writing a Python application using ZeroMQ and implementing a variation of the Majordomo pattern as described in the ZGuide. I have a broker as an intermediary between a set of workers and ...
2
votes
4answers
2k views

Pros of start learning programming with Python if what I really want is Javascript? [closed]

A friend of mine seeks to learn Javascript programming but he never programmed before. I've found Python as a quite nice language that takes most unneeded "strangeness" out of learning programming ...
16
votes
3answers
1k views

How to solve the problem of nested comments

It appears in not just one language that comments can't be nested. Do you have a good solution for this problem? One workaround in C/C++ and Java is to only use the single-line comment but it becomes ...
0
votes
0answers
57 views

Why complex is better than complicated? [duplicate]

In python, when you "import this", you can get The Zen of Python. It says "Complex" is better than "Complicated". Why is that? What's the difference between complex and complicated in programming ...
0
votes
1answer
471 views

Should I use webKit or is there a better technology to make a browser in Windows [closed]

I create web applications most in RoR and PHP. About a year ago a company wanted to use my app but in a stand alone browser window in Linux, so I wrote one in python using webkit, locked it down to ...
1
vote
0answers
211 views

Watching file changes/additions/removal, but with an eye on partial transfer

I would like to monitor the filesystem in python, so that my application gets warned of the new file addition, file removal, or file change. Once the file is detected, the application starts ...
0
votes
2answers
501 views

How my website should use its own API?

Im building small web-service which will provide my users with data through API. Also, some data will be available right on my website. The question is about how to use my own API? Should my website ...
0
votes
1answer
619 views

How to deal with database connections in a Python library module

I have created a library in Python that contains functions for accessing a database. This is a wrapper library around a third party application database, written due to the fact that the third party ...
6
votes
1answer
403 views

Object oriented vs vector based programming

I am torn between object oriented and vector based design. I love the abilities, structure and safety that objects give to the whole architecture. But at the same time, speed is very important to me, ...
0
votes
3answers
279 views

Object design where hard-coded values are used to instantiate objects?

I'm creating the design for a browser bookmark merging program and I've ran into a design problem that I've seen before yet I've never come up with a good solution for it. So lets say I have a ...
2
votes
2answers
385 views

How can I keep a production Python environment secure?

Most of my work is creating websites in Django (a Python web framework) and deploying them to my own or clients' servers. I work from a virtualenv to separate site from system packages and have ...
4
votes
2answers
2k views

Developing Python on Windows and deploying to Linux

I have a client who would prefer to host their application on Linux. However, my coworkers and I have very little experience with Linux. This is a short project with a low budget, so making choices ...
3
votes
3answers
431 views

How to rotate an array of bits

I currently have a PIL Image object which I store as an array of bits (1's and 0's). However I now would like to be able to rotate that image 45 degrees. One way to do it is take the original PIL ...
2
votes
5answers
428 views

The rationale behind Falsy values [closed]

I'm wondering what the arguments for/against Falsy values are. On what principles would you decide to add or exclude them from a language? Are there any problems you could see them causing off-hand? ...
3
votes
2answers
1k views

What is the way to go to extract data from websites?

I've been thinking about a side project that envolves web data scraping. Ok, I read the Getting data from a webpage in a stable and efficient way question and the discussion gave me some insights. ...
5
votes
4answers
442 views

How to create different paths for users to take through the pages in my site?

I have a website where users are directed to go through a sequence of pages to perform a sequence of work tasks (transcribe a paragraph, answer a survey, interact with another user, etc). For short, ...