from itertools import product
def breadth_first_product(*args):
	"""Works like itertools.product but iterates "breadth first".
...

Python Breadth first cartesian pro...

by abrakadabra42.myopenid.com, January 02, 2012 17:28, 17 refactorings, tagged with iterators, cartesian product

There must be an easier way...

55502f40dc8b7c769880b10874abc9d0 Talk
#imported modules
import os
import random
...

Python final course program

by ruok1212.myopenid.com, December 14, 2011 17:35, 3 refactorings

I cant get my program to wo...

55502f40dc8b7c769880b10874abc9d0 Talk
import array

byte_array = array.array('B', uploaded_file_instance.read(uploaded_file_instance.size))
...

Python Django UploadedFile instanc...

by slimkrazy.myopenid.com, November 30, 2011 03:36, 1 refactoring, tagged with python, django, files, binary strings

A third party library requi...

55502f40dc8b7c769880b10874abc9d0 Talk
def foo(mylist):
    magic  = 0
    for i in range(len(mylist)-1):
...

Python Two loops on list

by Tafkas, October 20, 2011 03:19, 2 refactorings, tagged with loop, list

I want to apply some calcul...

693a4661eaa71435ce5ebe61de64c5a4 Talk
select distinct(user_id) from facebook_post_comments where page_id =some_page_id and user_id in (select distinct(user_id) from facebook_post_comments where page_id = some_other_page_id)

Python MySQL O(n^2)

by https://www.google.com/accounts/o8/id?id=AItOawlXyCfS3cPSoWLo635rrzVPpmDr0-DUdus, October 20, 2011 12:54, 2 refactorings, tagged with sql, mysql, short clean ruby

Hello! Trying to run this q...

55502f40dc8b7c769880b10874abc9d0 Talk
# group by year,month of epoch integer and get count of groups
# where status == A. Data is stored in postgres

...

Python SQLalchemy Cleanup?

by https://www.google.com/accounts/o8/id?id=AItOawkVnMGHZ8OQzIo-_s-pjTis-yeOsejMNsc, October 14, 2011 12:36, No refactoring, tagged with sqlalchemy

Yesterday I found myself wr...

55502f40dc8b7c769880b10874abc9d0 Talk
import sys
from random import randint
for i in range(1, 7):
...

Python 6 bit password generator

by https://www.google.com/accounts/o8/id?id=AItOawl3BeAhTXKYDpKI7ld64fgVwaukoKGEuUo, September 04, 2011 04:17, 5 refactorings, tagged with random, python

I needed 6 random(ish) bits...

55502f40dc8b7c769880b10874abc9d0 Talk
import unittest

def longest_repeating_subsequence(seq):
...

Python Longest Repeating Subsequence

by Ben Atkin, September 29, 2011 20:39, 1 refactoring, tagged with lists, algorithm, sequence

Can you make it faster whil...

70b0265140eaff6e312eb3efcff3c195 Talk
def changeWordSize ( words, inSize, outSize ):
    """
    >>> list( changeWordSize( [255, 18], 8, 1 ) )
...

Python changeWordSize

by Leif Ryge, July 18, 2011 18:31, No refactoring, tagged with generator, generators, binary, bitwise, bitshift, ordinal, words

Generator which transforms ...

264124475f095b65634c53da3380b88d Talk
import csv, ConfigParser, datetime, time
from lxml import etree

...

Python XML Schema parsing and XML ...

by https://www.google.com/accounts/o8/id?id=AItOawnskEpQmE0uSHiw6mtC_WFcUDNCuvejHdE, July 21, 2011 10:08, No refactoring, tagged with xml, parsing, xsd, lxml

I wrote a tool to parse som...

55502f40dc8b7c769880b10874abc9d0 Talk
def to_bits(number):
  bit = 1
  bits = []
...

Python extract bits from number

by Shay Erlichmen, June 09, 2011 10:48, 3 refactorings, tagged with python, bitwise

extract the bits components...

B5b3262f246b9c41f5298adc62747d52 Talk
#!/usr/bin/python
"""rss2email: get RSS feeds emailed to you
http://rss2email.infogami.com
...

Python output to html attachment i...

by nath75.myopenid.com, June 25, 2011 11:59, No refactoring

I'm trying to mod rss2email...

55502f40dc8b7c769880b10874abc9d0 Talk
import sys 
from math import log 

...

Python Haar Transform

by talonx, June 16, 2011 11:33, No refactoring, tagged with speed, python, haar

Using a list for storing th...

Dc8678ff6917f939f852bea6e469b829 Talk
# This file is part of python-magento-api

# python-magento-api is free software: you can redistribute it and/or
...

Python Python Magento API

by omouse, May 27, 2011 18:20, 1 refactoring, tagged with python, api, magento

A Python-based API to the M...

0fc5485611721e78b1583657212a046a Talk
storeList = dom.select("//table/tr/td[@width='642']/table/tr/td[@width='180']/text()").extract() #store names
addressHTML = dom.select("//table/tr/td[@width='642']/table/tr/td[@class='tableitem']").extract() #store addresses, contains HTML so we need to parse out the actual address
addressList = []
...

Python Merging two addresses into ...

by Hiawatha, April 20, 2011 02:27, 5 refactorings

Hi, I'm brand new to Python...

4df33f9e8a81cc9d8046f057dbb4debc Talk
#/usr/bin/env python

__author__ = 'Luiz Augusto de M. Morais'
...

Python isprime

by https://profiles.google.com/luizaugustomm, April 13, 2011 19:22, 3 refactorings, tagged with python, Prime, Prime Numbers

This code contains a functi...

55502f40dc8b7c769880b10874abc9d0 Talk
#!/bin/env python

"""
...

Python Learning Python

by michael92956.myopenid.com, April 19, 2011 03:58, 3 refactorings, tagged with file, parse, log

I am comfortable with Unix ...

55502f40dc8b7c769880b10874abc9d0 Talk
def merge_words(words_1, words_2, words_3):
    """Take 2 to 3 lists of phrases and return 1 list of all combinations
    of those lists"""
...

Python Find All Combinations of 2 ...

by https://www.google.com/accounts/o8/id?id=AItOawnF67iZ7jkF06oL0iuNySBalihADlPMJ-8, March 15, 2011 01:15, 6 refactorings, tagged with lists, combinations

The code should accept thre...

55502f40dc8b7c769880b10874abc9d0 Talk
#!/usr/bin/env python
# -*- coding: utf-8 -*-

...

Python Python Koan Score Function

by lynxx, January 02, 2011 13:19, 6 refactorings, tagged with python, koans, gamble

I am brushing up on my Pyth...

16a142856cb73e3a64a989b121daddd3 Talk
# Load the required modules
import random
import sys
...

Python Secure password generation ...

by deepspring, January 02, 2011 11:11, 3 refactorings

I've been playing around wi...

56438d61fd1c1b7d352a12c9b402f4a9 Talk
import urllib
import urllib2
import socket
...

Python Hacking on stashboard

by https://www.google.com/accounts/o8/id?id=AItOawm9KPn_KBr_DmJv8_XERiiYT9NeXM0p6q8, January 14, 2011 22:22, 3 refactorings, tagged with google, appengine, stashboard

I'm a python noob. Tell me ...

55502f40dc8b7c769880b10874abc9d0 Talk
def showruns(self, lst, n):
    """
      assumes that lst is already sorted
...

Python Show a list of at least n c...

by alokt, January 08, 2011 18:39, 2 refactorings

Python n00b here. It works ...

D53ae50cd01c8159bbd9c45e10bf1bf7 Talk
#imported modules
import os
import random
...

Python encryption/decryption program

by https://me.yahoo.com/a/UQ.IiSl4notHYWA4oeCbS43hXJ44tQ--, December 08, 2010 19:04, 17 refactorings

Hello! Long time browser, f...

55502f40dc8b7c769880b10874abc9d0 Talk
def zip_plus(source_list, additional_list):
    """
        Like zip but does plus operation where zip makes a tuple
...

Python variations on zip

by https://www.google.com/accounts/o8/id?id=AItOawnsm--vLmQJ3pTQIjTkYd0hwwcCxZEprhY, December 15, 2010 01:52, 1 refactoring, tagged with python, lists

2 functions i need to build...

1afbba5d8a998738ce0d272860f8884e Talk
docs = [[
    re.sub(re.compile(r'\s+',re.M|re.S),' ',
    re.sub(' ',' ',
...

Python 2-levels mapping and severa...

by https://www.google.com/accounts/o8/id?id=AItOawnIj5nQFWAcqcdfHgLfzs3Ngw8moQG-ggo, November 04, 2010 17:33, 1 refactoring

I'm translating Ruby code i...

55502f40dc8b7c769880b10874abc9d0 Talk