1
2
3
    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...

Avatar Talk
1
2
3
from itertools import chain
...

Python On Sieve of Eratosthenes

by rodion_89, July 01, 2010 20:27

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

Avatar Talk
1
2
3
4
#!/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
1
2
3
4
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 ...

Dfcee31b345c5529099e574dfd0828f7 Talk
1
2
3
4
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 ...

Dfcee31b345c5529099e574dfd0828f7 Talk

Python On Poker sequence

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

thanks for feedback!
>Is g...

Avatar Talk

Python On Poker sequence

by Ants, May 13, 2010 18:10

Is get_combinations() reall...

F9a9ba6663645458aa8630157ed5e71e Talk
1
2
3
4
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 ...

Avatar Talk

Python On Validating argument

by Python Wackjob, April 16, 2010 19:28

In general, it is considere...

Avatar Talk
1
2
3
4
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
1
2
3
4
        # 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

Avatar Talk
1
2
3
4
class X:
    self.valid_months = range(12)
    self.valid_days = range(1, 32)
...

Python On Validating argument

by vanhellion, April 12, 2010 12:54

Simpler to just use lists, ...

Avatar Talk
1
2
3
# 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
1
2
3
4
    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...

Avatar Talk
1
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
1
perl -pi -e 's|<p><a.*||s'

Python On Regexp extraction in Python

by nicerobot, March 17, 2010 17:28

If that's the entire file, ...

7f69b0a9f0a030c37dca69736abb9f39 Talk
1
2
3
4
we have: 
--------

...

Python On Regexp extraction in Python

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

2nicerobot, thx for reply!
...

Avatar Talk
1
2
3
4
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
1
2
import itertools
itertools.permutations([1,2,3],3)

Python On Computing permutations with...

by Gabriele, March 15, 2010 23:03
Avatar Talk
1
(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 ...

Avatar Talk
1
2
3
4
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
1
2
3
4
def space_out_camel_case(s):
    """Adds spaces to a camel case string.  Failure to space out string returns the original string.
    >>> space_out_camel_case('DMLSServicesOtherBSTextLLC')
...

Python On CamelCase to Camel Case (Py...

by onk, March 07, 2010 19:38

Positional regex.

931ae7bf5fe3d90dc7016c7e8058e734 Talk
1
2
3
4
def permiter(ni):
    if not ni:
        yield []
...

Python On Permutation of values

by Hugh Brown, March 05, 2010 22:38

Simple code using generator...

Bbcac97b68f9e9cabd25a3f0f0bdbe49 Talk
1
2
3
4
from django.db import models

# Create your models here.
...

Python On Create a Dict from a Model

by Sam Thomson, March 02, 2010 18:48

This uses list comprehensio...

1c014f0c48fc85edb8e8e28a1e8bb8ae Talk