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.
-4
votes
2
answers
232
views
How to make this snippet DRY (Don't Repeat Yourself) [closed]
I know it's not that bad, but I can't help but wonder if there is a way to make this DRY-er.
s = self.start
e = self.end
if s.x > e.x:
s.x, e.x = e.x, s.x
if s.y > e.y:
s.y, e.y = e.y, s.y
1
vote
1
answer
137
views
Generate range of characters
import string
def charRange(mini, maxi, step=1):
if mini in string.ascii_uppercase:
strg = string.ascii_uppercase
else:
strg = string.ascii_lowercase
return (strg[i] for i in
…
6
votes
1
answer
678
views
Simple Calculator with customizable button layout
How can I improve the code? Specifically, is there any way that I can move the code from App.handle into separate functions?
from tkinter import *
import operator
# tuple of buttons in the calculato …
3
votes
1
answer
224
views
Snake videogame in Python
I made a Snake game in Python 3 with pygame. Please do critique it as much as possible. …