Tagged Questions

Python is an interpreted, general-purpose high-level programming language whose design philosophy emphasizes code readability.

learn more… | top users | synonyms

2
votes
2answers
37 views

What is better? For-loops or list descritpors (in cases like this)

Which version of this code is better? Ver 1. a = 0 for i in xrange( 1000 ): if i % 3 == 0 or i % 5 == 0: a += i print a Ver 2. from operator import add print reduce( add, ...
2
votes
1answer
38 views

Python Markdown Static Blogger program

I was hoping I might get some of the brains in Stack Overflow to take a look at my Python static blogger application. I've been using it a few years in a pretty hacked up form. Lately I decided to ...
3
votes
2answers
68 views

please suggest optimization

i took the python class at google code today. And this is what i made for the problem where they ask you to build a word counter. Please take a look and suggest any improvements that can be done. ...
3
votes
3answers
81 views

Thinking in python

Magnus Lie Hetland in his Beginning python wrote a code to replicate the range() built-in. def interval(start, stop=None, step=1): if stop is None: start, stop = 0, start result = ...
0
votes
0answers
7 views

Python SyntaxError: invalid syntax [migrated]

I received a Python command line program used for chess rating from a fellow chess lover, and find myself with the following syntaxError: File "skype-chess.py ", line 257 if cmd ==sss "rate " and ...
4
votes
3answers
22 views

Efficient, clean, readable, Python code

Me and a friend setup a competition between ourselves with the goal: Print out all numbers in the Fibonacci sequence that are less than or equal to 3000 using Python. The winner was whoever could ...
1
vote
0answers
28 views

HNews “ask section” page scraping Python script

Here is a small script I wrote to get the HNews ask section and display them without using a web browser. Just looking for feed back on how to improve my style/coding logic/overall code. ...
1
vote
0answers
34 views

implementing simple stream processor with sockets

I'm trying to implement simple data streamer in Python with sockets. Consider one server and one or more clients. I just want to read data from server, process it and send it to the client. Here's how ...
0
votes
0answers
15 views

implementing simple stream processor with sockets [closed]

Possible Duplicate: implementing simple stream processor with sockets I'm trying to implement simple data streamer in Python with sockets. Consider one server and one or more clients. I ...
0
votes
0answers
17 views

LCS implementation in python2 [migrated]

I implemented an n-dimensional longest common subsequence in python, but it's buggy. The keys of the grid I generate have sometimes negative indices (see output below), but I don't use any negative ...
0
votes
1answer
73 views

Improving code style python

i have the following piece of code, that i think needs improving. However i don't even know where to start optimizing. What should i improve in terms of readability and speed? import PIL.ImageGrab ...
0
votes
2answers
62 views

Can this python generator be made more efficient?

I'm trying to get a better grasp on generators in python because I don't use them enough (I think generators are cool). To do so I wrote a generator for prime numbers: def primes(): x = 2 ...
1
vote
1answer
36 views

Wrote python code for blackjack casino game, it's runs but just looking to improve it if possible

Question: Blackjack (twenty-one) is a casino game played with cards. The goal of the game to draw cards that total as close to 21 points as possible without going over. All face cards count as 10 ...
1
vote
1answer
28 views

Revision Suggestions for an efficient Python (with Curses GUI) Program

I wrote a Python mp3 player for linux using pygame, with a curses GUI and a mouse-only interface. It's purely for personal use. It hasn't been polished yet, but for now I'd like to know what I've ...
2
votes
2answers
64 views

Python: looking for a more pythonic implementation that reduces nested loops

I am relatively new to the Python world from C#/Java. I love how the language makes many tasks simpler. Here is my question: display_val = [] for selected in boundfield.data: for circle in ...

1 2 3 4 5 15
15 30 50 per page