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 ...
1
vote
0answers
35 views
idea mapping with global state [on hold]
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 ...
-1
votes
0answers
82 views
Is Python the Best Language For Me To Learn Programming On? [on hold]
Today I started taking a computer programming class at my high school. The teacher has started to teach us python. I have always heard from my programmer friends that C, C++ , C#, and Java are the ...
-3
votes
1answer
109 views
How to create interest in programming despite having basic knowledge? [on hold]
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
95 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
93 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, ...
3
votes
1answer
98 views
Python 2.7 - 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
7 views
how to setting pip.ini to use cert [migrated]
How to setting pip.ini to use cert for each link/url/find-links, example:
find-links = http://x.y.z/simple/
cert = xxx.pem
http://a.b.c/simple/
cert = sss.pem
...
-1
votes
0answers
15 views
Resources for extracting and correlating contact information from text [on hold]
I am looking to extract and correlate contact information from text (as the title says). I have some specific goals, which I will lay out below. Can anyone provide me with some more resources ...
0
votes
0answers
50 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
104 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
278 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 ...
-1
votes
0answers
15 views
Repeated error messages from scrapy log module [closed]
I had a working Spider earlier today, which I seem to have messed up by trying to change the spider module name and then revert that change.
It seems that now I get strange errors in my log as ...
0
votes
0answers
13 views
How to make a button press have different outputs depending on time pressed in Python? [migrated]
I am attempting to learn how to program a little. I am making this script for my Raspberry Pi, but the concept doesn't have to be specifically for it. I want to have a button press that will execute ...
6
votes
3answers
171 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
0answers
15 views
installation of non-existent package in Cygwin [closed]
I want to install python-wxgtk2.8 in cygwin, but apt-cyg install python-wxgtk2.8 won't find it. It is not existent in the packages included in the setup process. Do you have an idea how I can install ...
0
votes
0answers
7 views
Flushing out data from Popen buffer [migrated]
I am working on a python script that reads data by tailing a file and then puts in a different file. The script works in a time bound manner and eventually flushes out the data from the buffer when ...
-1
votes
0answers
33 views
How to find out what the modules do for python [migrated]
Ok, I know the dir() function , but I get all this
>>> dir(sys)
['__displayhook__', '__doc__', '__excepthook__', '__loader__', '__name__', '__package__', '__stderr__', '__stdin__', ...
0
votes
0answers
13 views
Weird behavior when calling subprocess in python on vlc [migrated]
I'm making a python script that starts a udp stream from vlc and send a message to a client that the stream is now running.
The problem is when im trying to start the udp stream from python with the ...
-2
votes
0answers
60 views
Python: Real word problems [closed]
I have been working in python for about two years. I have done mostly games and functions to help power my games efficiently as well as many of my own custom tools to make writing games faster and ...
-2
votes
0answers
57 views
readlines() function in Python [migrated]
When I type the following into a .py file (using version 2, if that matters) and run,
f=open('file.txt','r')
for line in f:
print line
all lines of my file 'file.txt' are printed in ...
0
votes
1answer
73 views
Python: is 2to3 reliable to convert python 2 to python 3? [closed]
I've been playing with 2to3 for quite a while. But can I totally rely on 2to3? Can I write big projects and simply run it? If so I'll converting my codes to python 3.
-2
votes
1answer
70 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 ...
0
votes
0answers
46 views
Is semi-supervised learning in a dynamic system possible? [closed]
So, I've been reading up on natural language processing and machine learning for a few days now and I have a good understanding conceptually at this point, however I'm a little confused about how to ...
2
votes
2answers
70 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 ...
0
votes
0answers
9 views
Python 3 print() function [migrated]
Im trying to get an exercise from a python 2 book to work in python 3.
1 def printMultiples(n):
2 i = 1
3 while i <= 6:
4 print(n*i, '/t',)
5 i = i + 1
6 print()
My problem is ...
18
votes
3answers
875 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
1answer
61 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
98 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
138 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
192 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
29 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
128 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 ...
1
vote
1answer
51 views
Additional actions in setup.py for install
Background
So, I'm developing a project, and I'm writing setup.py script for it, using distutils. I'm using CPython3.3.
I use some libraries that have invalid distributions in PyPI, so they have to ...
0
votes
0answers
10 views
Getting gae_bingo to run properly [migrated]
I'm trying to conduct A/B testing on Google App Engine and came upon gae_bingo but have trouble setting it up.
I'm having these issues.
I'm getting a 404 error when trying to access the dashboard ...
4
votes
3answers
226 views
Which is better API: table.add_row() or table.rows.add()?
I'm writing a library to create and manipulate Word .docx files in Python. In general, I take a lot of influence from the Microsoft VBA/C# API for Word in designing the API, figuring they've given it ...
4
votes
3answers
77 views
Python: How to decide which class' methods should provide behavior (functionality) affecting multiple classes
I have a question about object oriented design that is not specific to Python but since my code is in Python, I tagged it as such. How do I decide which of my classes should be responsible for ...
0
votes
2answers
73 views
Google App Engine overview
I have gone through many Google App Engine tutorials, and I became quite familiar with how to do basic stuff like implementing a webapp2.RequestHandler, and using ndb.Models to manage your data.
Now, ...
1
vote
4answers
182 views
How should you cleanly restrict object property types and values in Python?
I have been learning python from no long time ago. But nearly at the beginning I stumbled on simple question:
how to set a restriction (limitation) on object value or object's properties without ...
3
votes
2answers
82 views
Writing a unit test for a platform dependent unit
I have a method to be tested which depends on the OS, what's the best approach for testing the method depending on the OS? Is it to test on every OS that I have I require? Is there a better approach ...
-3
votes
1answer
41 views
Pausing Python Tkinter Program [closed]
I have made a card matching game using python, and I need it so that when two cards are selected, they are shown for a few seconds and then the code executes to get rid of them or return them. I have ...
0
votes
2answers
212 views
Model-View-Controller — Where does a factory class go?
I'm working (slowly) on a small Flask project. One of my models is a class called Post, which is a lightweight namedtuple. Post objects are created by a PostFactory, because creating a Post involves ...
3
votes
2answers
124 views
Python - defining exit method before importing
This breaks nothing (in my experience), but lots of things "don't break anything" and are still wrong.
#! /usr/bin/env python
"""Short description of this module."""
def ...
0
votes
3answers
243 views
What is the difference between 'code readability' and 'language conventions' used within a community? [closed]
When I'm looking at questions asked on sites like stackoverflow on how to make a particular piece of code "more pythonic" there are usually suggestions offered to use complex list comprehensions or ...
1
vote
2answers
115 views
How can I automate the process of code review
I have a team that works on multiple technologies. I want to know how can I automate the process of code review for .Net, .Net MVC, Python, PHP, Drupal and HTML5/CSS with JavaScript.
I have read ...
1
vote
1answer
89 views
How do we pass data between two Amazon instances?
I'm trying to create a website where the user enters a few numbers, these numbers are fed into some equations, and the output of these equations is emailed to the user. I'm using Python 2.7 for ...
1
vote
1answer
74 views
Is using os.environ to store the value of command line switches pythonic?
I write CLI-executable Python 3 scripts regularly to do data compilation and some maintenance tasks, and try to adhere to PEP 8 and the Google Python Style Guide when doing so. Google's guide says to ...
0
votes
2answers
58 views
How to make the leap from classification to clustering
I have a clustering problem which I can't seem to solve, although if I treat it as a labeled classification problem, I can solve it with satisfactory precision. Is there an elegant way to make the ...
0
votes
1answer
71 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
40 views
processing Postfix log with python
I need to process all log messages from Postfix (/var/log/mail/mail.log), and print a summary/statistics (how many emails were sent/received and from/to which email addresses)
The situation is made ...
0
votes
3answers
103 views
Tips for developing a mobile app with a team [duplicate]
I am currently a high school student, I've been assigned to manage a group in my school to develop a mobile app and the problem is that all of us have no experience in making a project in a team and ...