python

sudoku obfuscated python -> perl translation

Anybody care to translate this into obfuscated perl? It's written in Python taken from: here def r(a):i=a.find('0');~i or exit(a);[m in[(i-j)%9*(i/9^j/9)*(i/27^j/27|i%9/3^j%9/3)or a[j]for j in range(81)]or r(a[:i]+m+a[i+1:])for m in'%d'%5**18] from sys import*;r(argv[1]) I realize it's just for fun :) ...

Komodo Extension

Continuing on with my Python learning, I just installed Komodo edit, are there any recommended add ins/extensions that I should include? Any recommendations on using it or another GUI designer (TkInter base)? ...

Recursive Function palindrome in Python

I need help writing a recursive function which detects whether a string is a palindrome. But i can't use any loops it must be recursive. Can anyone help show me how this is done. I need to learn this for an upcoming midterm. Im using Python. ...

caching issues in MySQL response with MySQLdb in Django

I use MySQL with MySQLdb module in Python, in Django. I'm running in autocommit mode in this case (and Django's transaction.is_managed() actually returns False). I have several processes interacting with the database. One process fetches all Task models with Task.objects.all() Then another process adds a Task model (I can see it in ...

How to sort based on dependencies?

I have an class that has a list of "dependencies" pointing to other classes of the same base type. class Foo(Base): dependencies = [] class Bar(Base): dependencies = [Foo] class Baz(Base): dependencies = [Bar] I'd like to sort the instances these classes generate based on their dependencies. In my example I'd expect ins...

Inferring appropriate database type declarations from strings in Python

I am building some Postgres tables from Python dictionaries where the {'key': 'value'} pairs correspond to column 'key' and field 'value'. These are generated from .dbf files -- I now pipe the contents of the .dbf files into a script that returns a list of dicts like: {'Warngentyp': '', 'Lon': '-81.67170', 'Zwatch_war': '0', 'State':......

Help me find an appropriate ruby/python parser generator

The first parser generator I've worked with was Parse::RecDescent, and the guides/tutorials available for it were great, but the most useful feature it has was it's debugging tools, specifically the tracing capabilities ( activated by setting $RD_TRACE to 1 ). I am looking for a parser generator that can help you debug it's rules. The t...

Making a flat list out of list of lists in Python

Possible Duplicates: Flattening a shallow list in Python Comprehension for flattening a sequence of sequences? I wonder whether there is a shortcut to make a simple list out of list of lists in Python. I can do that in a for loop, but maybe there is some cool "one-liner"? I tried it with reduce, but I get an error. Code l =...

Explicit access to Python's built in scope

How do you explicitly access name in Python's built in scope? One situation where I ran in to this was a in module, say called foo, which happened to have an open function. In another module foo's open function would be accessible as foo.open which works well. In foo itself though, open blocks the built in open. How can you access ...

Why won't python allow me to delete files?

I've created a python script that gets a list of files from a text file and deletes them if they're empty. It correctly detects empty files but it doesn't want to delete them. It gives me: (32, 'The process cannot access the file because it is being used by another process') I've used two different tools to check whether the files a...

SSH Connection with Python 3.0

How can I make an SSH connection in Python 3.0? I want to save a file on a remote computer where I have password-less SSH set up. ...

Check unread count of Gmail messages with Python

How can I check the number of unread Gmail message in my inbox with a short Python script? Bonus points for retrieving the password from a file. ...

Which gps library would you recommend for python?

I'm looking for a free library for python that can calculate your direction and your speed from GPS coordinates and maybe can calculate if you are in some boundaries or things like this. Are there Libraries that you know and that worked well for you? Edit: Ok it seems I have to specify this a little bit. We are using python on a linux...

how to program functions with alternative return value signatures in python? (next() for alternative iterators)

e.g. so that these would both work - is it possible? (val,VAL2) = func(args) val = func(args) Where val is not a tuple For example I'd like these to work for my custom object something for item in something: do_item(item) #where again item - is not a tuple for (item,key) in something: do_more(key,item) I thought that I n...

Error running tutorial that came along wxPython2.8 Docs and Demos

I tried the following example code from the tutorial that came along "wxPython2.8 Docs and Demos" package. import wx from frame import Frame class App(wx.App): """Application class.""" def OnInit(self): self.frame = Frame() self.frame.Show() self.SetTopWindow(self.frame) return True def main()...

Choosing between Java and Python

My team is faced with change. We develop on Unix, on backend servers. We do no GUI development. We are the business logic between another team's Java front end (XML interface) and the database. Currently our codebase is large, and it's all in C. We are held back by having to work with a very primitive ancient home-made non-relational no...

Django Powered Sites

Are there any sites in the top Alexa or Compete 1000 powered by Django? I cannot find any. If not, is there a reason for this? It seems like a framework suited for rapid development with deployment options (fast cgi, mod_wsgi, mod_python) that are efficient. Am I missing something? ...

PyS60 application not going full screen

Hi, I am very new to PyS60. I was testing how to set an application to full screen mode but unfortunately, it doesn't work as expected. I tested the script on Nokia 6120 Classic. Here is what I did: appuifw.app.screen = 'full' What I get is a half screen of my application with a plain white colour below. What am I doing wrong? Thank...

Getting object's parent namespace in python?

Hello. In python it's possible to use '.' in order to access object's dictionary items. For example: class test( object ) : def __init__( self ) : self.b = 1 def foo( self ) : pass obj = test() a = obj.foo From above example, having 'a' object, is it possible to get from it reference to 'obj' that is a parent namespace fo...

Help with Django app and payment systems (general queries)

Hi guys, So I'm working on an app in Django, however this is my first time venturing into advance integration for a webapp with payment systems (I used to work with paypal/2checkout so it was pretty no-skill-required). My partners have chosen PaymentExpress, and there are several sets of API (all of which are pretty new to me) and they...