def isSyncronized(self):
    NO_SYNC = 1
...

Python On nested if blocks

by wapcaplet.myopenid.com, October 31, 2010 05:09

Just a minor suggestion: yo...

787d7ca239e1bf116028ea1028b245b8 Talk
def get_combinations(sequence,joker=10):
    value, count = [x for x in sequence if x <> joker][0], 0
    for x in sequence:
...

Python On Poker sequence

by Euribates, September 16, 2010 14:16

Maybe `get_max_score` would...

908b7a69963a2dc80cdcc3abc2b3edb4 Talk

Python On algoritmo collatz

by Cr44c1n0l4s, September 10, 2010 22:38

Muito legal o código ! :D

D41d8cd98f00b204e9800998ecf8427e Talk
def isSyncronized(self):
        if not (hasattr(self, "prog_name") and hasattr(self, "sync_file")):
...

Python On nested if blocks

by Peter Jensen, August 06, 2010 20:28

I'd drop the return False; ...

01251618b96a1447274b088c62d27786 Talk

Python On nested if blocks

by Tony, August 05, 2010 01:54

(Whoops, I accidentally gav...

D41d8cd98f00b204e9800998ecf8427e Talk
from itertools import chain
...

Python On Sieve of Eratosthenes

by rodion_89, July 01, 2010 20:27

It's ugly, but it makes sen...

D41d8cd98f00b204e9800998ecf8427e Talk
#!/usr/bin/env python                                                                                                                                             

from twisted.internet.protocol import ClientCreator, Protocol
...

Python On Twisted tcp client

by https://www.google.com/accounts/o8/id?id=AItOawkapZWfDKPlzk45bKWi1klRG7GdRd4leuU, July 01, 2010 07:21

Line ending is wrong. Shame...

13d35cfcb64d83bd4019053045cd95b4 Talk
class EasyFilter(object):
    def __init__(self, **kwargs):
        try:
...

Python On Django models search

by Ajit, May 25, 2010 11:11

Good work akaihola. I used ...

8db19a7c0b9030bc0fe927ba486d2818 Talk
class EasyFilter(object):
    def __init__(self, **kwargs):
        try:
...

Python On Django models search

by Ajit, May 25, 2010 11:05

Good work akaihola. I used ...

8db19a7c0b9030bc0fe927ba486d2818 Talk

Python On Poker sequence

by rullon.myopenid.com, May 15, 2010 19:51

thanks for feedback!
>Is g...

55502f40dc8b7c769880b10874abc9d0 Talk

Python On Poker sequence

by Ants, May 13, 2010 18:10

Is get_combinations() reall...

F9a9ba6663645458aa8630157ed5e71e Talk
import sys

#input into this structure
...

Python On Williams Words

by cmurphycode.blogspot.com, April 27, 2010 20:35

Oh My. A long journey took ...

55502f40dc8b7c769880b10874abc9d0 Talk

Python On Validating argument

by Python Wackjob, April 16, 2010 19:28 Star_fullStar_fullStar_fullStar_full

In general, it is considere...

D41d8cd98f00b204e9800998ecf8427e Talk
def get_pos(rel_dates):
    """returns the positions of the dates closest to 25%, 50%, and 75%"""
    ret = [0]
...

Python On Return the indexes of speci...

by Colin Wallace, April 13, 2010 22:43

I simply re-wrote redundant...

Dc77b8da112bc303c377785538c6228f Talk
# Continuation of above
        self.day = day
        assert year >= 0, 'year must be an integer 0 or greater'
...

Python On Validating argument

by vanhellion, April 12, 2010 12:57

Accidently hit submit

D41d8cd98f00b204e9800998ecf8427e Talk
class X:
    self.valid_months = range(12)
    self.valid_days = range(1, 32)
...

Python On Validating argument

by vanhellion, April 12, 2010 12:54 Star_fullStar_fullStar_fullStar_full

Simpler to just use lists, ...

D41d8cd98f00b204e9800998ecf8427e Talk
# from http://www.djangosnippets.org/snippets/1103/ import MultiQuerySet

entries = MultiQuerySet(sticky_entries, entries)

Python On Django combining querysets

by Matt Wilson, April 10, 2010 09:12

Try this: http://www.django...

3fb9cd29b758d6188283dbc27fae2ec6 Talk
def __init__(self, month, day, year):
        assert type(month) is int, "month must be an integer"
        assert type(day) is int, "day must be an integer"
...

Python On Validating argument

by bob, April 03, 2010 08:54 Star_fullStar_fullStar_full

one thing you could do is u...

D41d8cd98f00b204e9800998ecf8427e Talk
Notice Journey,neck vast basis payment floor consider national run government rise educational agree then trend selection component return master round therefore water price employee itself obvious need circumstance about sing ground crisis union problem sentence organise may responsible band pair project roll at stay used worker cut tend chapter officer wife notion season rate fight he means drug anyone price retain evidence success behind representation transfer thing customer someone lot design comparison apparent front membership avoid push demand narrow milk actual able vote name can

Python On Scale data points with the ...

by Hotels in Muenster vergleichen, April 01, 2010 11:50

Notice Journey,neck vast ba...

1e2f10fce9fd49548a219da4d7e7511c Talk
perl -pi -e 's|<p><a.*||s'

Python On Regexp extraction in Python

by nicerobot, March 17, 2010 17:28 Star_full

If that's the entire file, ...

7f69b0a9f0a030c37dca69736abb9f39 Talk
we have: 
--------

...

Python On Regexp extraction in Python

by rullon.myopenid.com, March 17, 2010 13:33

2nicerobot, thx for reply!
...

55502f40dc8b7c769880b10874abc9d0 Talk
import re

def process_html(str):
...

Python On Regexp extraction in Python

by nicerobot, March 17, 2010 12:46

1. Regular Expressions Are ...

7f69b0a9f0a030c37dca69736abb9f39 Talk
import itertools
itertools.permutations([1,2,3],3)

Python On Computing permutations with...

by Gabriele, March 15, 2010 23:03
D41d8cd98f00b204e9800998ecf8427e Talk
(lambda n:(lambda i=[n]:reduce(lambda a,x:(x!=1 and i.append(x%2 and x*3+1 or x/2)) or a+[x],i,[]))())(22)

Python On algoritmo collatz

by Anony, March 08, 2010 22:56

Not in any way better than ...

D41d8cd98f00b204e9800998ecf8427e Talk
from bisect import bisect

def pos(ls, x):
...

Python On Return the indexes of speci...

by onk, March 07, 2010 21:07

@bob's bisect.

3ac88630891949b4e0fa568f413d8cdb Talk