1
2
3
4
    def isSyncronized(self):
        NO_SYNC = 1
        UNDER_DATE = 2
...

Python nested if blocks

by marcosvanetta, July 25, 2010 01:28, No refactoring, tagged with python, method, metaprogramming

I wanna know if anyone can ...

Avatar Talk
1
2
3
4
def get_combinations(sequence,joker=10):
    """
    Checks duplicates in sequence, returns tuple with char and duplicate count
...

Python Poker sequence

by rullon.myopenid.com, May 11, 2010 13:27, No refactoring, tagged with python, poker

get max length of duplicate...

Avatar Talk
1
2
3
4
    def __init__(self, month, day, year):
        if type(month) != int:
            raise NotIntegerError, "month must be an integer"
...

Python Validating argument

by jluebbert.myopenid.com, April 03, 2010 08:08, 4 refactorings, tagged with python, validation, initialization

I'm learning python and I w...

Avatar Talk
1
2
3
4
entries         = BlogEntry.objects.filter(status=True,sticky=False,control_tags=controlTag)[offset:(offset+limit)]
sticky_entries  = BlogEntry.objects.filter(status=True,sticky=True,control_tags=controlTag)

...

Python Django combining querysets

by rullon.myopenid.com, March 23, 2010 21:19, 1 refactoring, tagged with python, django

When i combine this way, re...

Avatar Talk
1
2
3
4
import re

def process_html(str):
...

Python Regexp extraction in Python

by rullon.myopenid.com, March 17, 2010 10:22, 3 refactorings, tagged with python, regexp

Is it good way to extract p...

Avatar Talk
1
2
3
4
numbers  = [int(raw_input("enter number: "))]
p = lambda x: ((x % 2) and x * 3 + 1) or x / 2

...

Python algoritmo collatz

by sergio, February 25, 2010 15:54, 1 refactoring, tagged with python

Considere que, para um dete...

A5f3d249cc5053cdc1eb4ede60fd2f45 Talk
1
2
3
4
def get_pos(rel_dates):
    """returns the positions of the dates closest to 25%, 50%, and 75%"""
    pos = [0] # first element
...

Python Return the indexes of speci...

by Tafkas, January 28, 2010 19:53, 5 refactorings, tagged with dates, python, relative position

The function takes an list ...

693a4661eaa71435ce5ebe61de64c5a4 Talk
1
2
3
4
def scale_dates(dates):
    rel_dates = []
    first_day = dates[0]
...

Python Scale data points with the ...

by Tafkas, January 22, 2010 12:55, 3 refactorings, tagged with python, date, timestamp

In order to print a chart t...

693a4661eaa71435ce5ebe61de64c5a4 Talk
1
2
3
4
class MetaClass(type):
    def __new__(cls, name, bases, attrs):
        return super(MetaClass, cls).__new__(cls, name, bases, attrs)
...

Python How to dynamically pass bas...

by dominno, December 08, 2009 07:47, No refactoring, tagged with python, metaclass

I need to dynamically creat...

25cf66e4ecb9887c788ef2d13a2f8c16 Talk
1
2
3
4
#!/usr/bin/python
# Criado em:Dom 12/Ago/2007 hs 10:49
# Last Change: Dom 12 Ago 2007 11:11:06 BRT
...

Python equação do segundo grau

by sergio, July 10, 2009 19:42, 1 refactoring, tagged with python, math

Equação do segundo graum em...

A5f3d249cc5053cdc1eb4ede60fd2f45 Talk
1
2
3
4
def slug_to_lower(fn):
    """
    Decorator to lowercase string arguments to a function.
...

Python String args to lower decorator

by justinlilly.myopenid.com, June 04, 2009 18:04, 5 refactorings, tagged with python, decorator

This was used to convert Mi...

Avatar Talk
1
2
3
4
#?
import PIL
#?
...

Python Convert .pdf to .tiff

by setori88.myopenid.com, October 20, 2008 07:04, 4 refactorings, tagged with python, open office, conversion, PIL

Hello all

As the title s...

40975e93e1913ab7c55e019f69d64b1f Talk
1
2
3
4
#!/usr/bin/python

import socket,time
...

Python Connection Detection script

by matthew.scouten.myopenid.com, October 02, 2008 01:06, 3 refactorings, tagged with short, python, sockets

This is a Quick and Dirty s...

Avatar Talk
1
2
3
4
#!/usr/bin/python
# -*- coding: utf-8 -*-

...

Python Parse XML from Yahoo weathe...

by kael, August 26, 2008 17:27, 3 refactorings, tagged with python, dom, xml, rss

Is there a more efficient w...

Ec5a58db4acc016568e0293d283cbc2d Talk
1
2
3
4
#!/usr/bin/python
# -*- coding: utf-8 -*-

...

Python Base64 image encoding and i...

by kael, August 25, 2008 19:05, 2 refactorings, tagged with python, image, base64, hash, sha224

Is this a correct a way to ...

Ec5a58db4acc016568e0293d283cbc2d Talk
1
2
3
4
#!/usr/bin/python
# -*- coding: utf-8 -*-

...

Python Query TinyUrl the fastest way

by kael, August 25, 2008 18:44, No refactoring, tagged with python, http, tinyurl, urllib, urllib2

I'm looking for the fastest...

Ec5a58db4acc016568e0293d283cbc2d Talk
1
2
3
4
i = 0
for j in ['foo', 'bar', 'baz']
    puts "#{i} #{j}"
...

Ruby Python's enumerate in Ruby?

by robby86533.identity.net, July 14, 2008 23:02, 3 refactorings, tagged with python, ruby, for, enumerate

What is the best way to emu...

Cbb09ca8a832170ec73186f5c8cafba4 Talk
1
2
3
4
import wsgiref.handlers

from google.appengine.ext import webapp
...

Python Get request path using Goog...

by Zote, July 14, 2008 18:34, 1 refactoring, tagged with python, google application engine, gae, request path

if my url is http://zote.ap...

3079a42933388fed686653b9cd9affba Talk
1
2
3
4
def segment_pages(page):
    page.paginator.left = []
    page.paginator.right = []
...

Python Django / Python / Paginatio...

by bramston, June 11, 2008 04:58, 1 refactoring, tagged with django, python, pagination

Really quickly ported some ...

Eb74aac8da41a993ae9dd91a5b13b78a Talk
1
2
3
4

def sort(words):
...

Python Custom sort a list of words

by armandino.myopenid.com, December 10, 2007 02:36, 7 refactorings, tagged with python, sort

My second python script. :)...

2155c92be66863c4634778bf522efe14 Talk
1
2
3
4
import re

def addWord(token, frequencies):
...

Python Count word occurrences in a...

by armandino.myopenid.com, December 08, 2007 07:03, 9 refactorings, tagged with python

This code counts number of ...

2155c92be66863c4634778bf522efe14 Talk
1
2
3
4
class SearchLet(Form):
    district = Field(widget=SelectMultiple(choices=DISTRICTS, required=False)
...

Python Django models search

by lbolognini, November 10, 2007 16:30, 3 refactorings, tagged with python, django, search, orm

I'm using the following cod...

D2ff155cd04fa175620d2f3495b11b08 Talk