Search Results
Search type | Search syntax |
---|---|
Tags | [tag] |
Exact | "words here" |
Author |
user:1234 user:me (yours) |
Score |
score:3 (3+) score:0 (none) |
Answers |
answers:3 (3+) answers:0 (none) isaccepted:yes hasaccepted:no inquestion:1234 |
Views | views:250 |
Code | code:"if (foo != bar)" |
Sections |
title:apples body:"apples oranges" |
URL | url:"*.example.com" |
Saves | in:saves |
Status |
closed:yes duplicate:no migrated:no wiki:no |
Types |
is:question is:answer |
Exclude |
-[tag] -apples |
For more details on advanced search visit our help page |
Python is an interpreted, general-purpose high-level programming language whose design philosophy emphasizes code readability. Use the python tag for all Python related questions. If you believe your question may be even more specific, you can include a version specific tag such as python-3.x.
2
votes
Utility function to split a number into n parts in the given ratio
So in terms of code layout this is a little hard to follow, but apart form that is fine and the docstring is good. However, I'm not sure that your code gives the right result. Also it could also be sp …
11
votes
Accepted
Reducing lines in methods of Python class to manage tweets
Also it may be worth catching the certain errors that might be caused by your code, like invalid types for tweet_id (as python is dynamically typed). …
3
votes
Accepted
Class for connecting to mongodb databases and return collection object
Usually camel case is avoided in Python. Names like checkArgumentsLength should really be more along the lines of check_arguments_length. …
6
votes
Accepted
Rock, paper, scissors
So this all looks pretty good, with not much to review. I didn't see the previous question, so I will throw my two cents in here.
You define the following at the top of your file:
SIGNS = ("rock", " …
7
votes
Accepted
Best way to display big data
To format the data nicely for printing you can use the ljust method:
print "Country".ljust(15),"Population"
for country in countries:
print country["Name"].ljust(15), country["Population"]
13
votes
Accepted
Optimizing very simple piece of “Game of Life” code by taking advantage of NumPy's functiona...
I'll just be cheeky and post a slightly modified version of my SO answer here.
So first things first, you want to get rid of the loops. They are slow to execute.
The first loop:
for x in range(rows …