Re: Is there a better algorithm?

2009-01-02 Thread J Kenneth King
Kottiyath writes: > I have the following list of tuples: > L = [(1, 2), (3, 4, 5), (6, 7)] > > I want to loop through the list and extract the values. > The only algorithm I could think of is: for i in l: > ... u = None > ... try: > ... (k, v) = i > ... except ValueError: > ... (k, u,

Re: Is there a better algorithm?

2009-01-02 Thread J Kenneth King
Paul Rubin writes: > Kottiyath writes: >> I have the following list of tuples: >> L = [(1, 2), (3, 4, 5), (6, 7)] >> I want to loop through the list and extract the values. > > Others have suggested messy ways to code what you're asking. At another > level, that li

Re: Noob question: Is all this typecasting normal?

2009-01-06 Thread J Kenneth King
"Gabriel Genellina" writes: > En Mon, 05 Jan 2009 02:03:26 -0200, Roy Smith escribió: > > >> The other day, I came upon this gem. It's a bit of perl embedded in a >> Makefile; this makes it even more gnarly because all the $'s get >> doubled to >> hide them from make: >> >> define absmondir >>

Re: image recogniton?

2009-01-06 Thread J Kenneth King
Li Han writes: > Hi! I know little about the computer image processing, and now I have > a fancy problem which is how to read the time from the picture of a > clock by programming ? Is there anyone who can give me some > suggestions? > Thank! > Li Han I do work in object recognition, and I

Re: looking for tips on how to implement "ruby-style" Domain Specific Language in Python

2009-01-06 Thread J Kenneth King
Jonathan Gardner writes: > On Jan 6, 8:18 am, sturlamolden wrote: >> On Jan 6, 4:32 pm, mark wrote: >> >> > I want to implement a internal DSL in Python. I would like the syntax >> > as human readable as possible. >> >> Also beware that Python is not Lisp. You cannot define new syntax (yes >> I

Re: looking for tips on how to implement "ruby-style" Domain Specific Language in Python

2009-01-07 Thread J Kenneth King
Jonathan Gardner writes: > On Jan 6, 12:24 pm, J Kenneth King wrote: >> Jonathan Gardner writes: >> > On Jan 6, 8:18 am, sturlamolden wrote: >> >> On Jan 6, 4:32 pm, mark wrote: >> >> >> > I want to implement a internal DSL in Python. I

Re: looking for tips on how to implement "ruby-style" Domain Specific Language in Python

2009-01-07 Thread J Kenneth King
Kay Schluehr writes: > On 7 Jan., 16:50, J Kenneth King wrote: > >> Python expressions are not >> data types either and hence no macros -- I can't write a python function >> that generates python code at compile time. > > Have you ever considered there a

Re: looking for tips on how to implement "ruby-style" Domain Specific Language in Python

2009-01-08 Thread J Kenneth King
Jonathan Gardner writes: > On Jan 7, 9:16 am, "Chris Mellon" wrote: >> >> The OP wants a Ruby-style DSL by which he means "something that lets >> me write words instead of expressions". The ruby syntax is amenable to >> this, python (and lisp, for that matter) syntax is not and you can't >> impl

Re: looking for tips on how to implement "ruby-style" Domain Specific Language in Python

2009-01-08 Thread J Kenneth King
Kay Schluehr writes: > On 8 Jan., 16:25, J Kenneth King wrote: > >> As another poster mentioned, eventually PyPy will be done and then >> you'll get more of an "in-Python" DSL. > > May I ask why you consider it as important that the interpreter is &

Re: PIL problem

2008-10-08 Thread J Kenneth King
bfrederi <[EMAIL PROTECTED]> writes: > I am having a problem using PIL. I am trying to crop and image to a > square, starting from the center of the image, but when I try to crop > the image, it won't crop. Here are the relevant code snippets: > > ### Function I am testing ### > def create_square_

Re: PYTHON WORKING WITH PERL ??

2008-10-16 Thread J Kenneth King
Pat <[EMAIL PROTECTED]> writes: > Sean DiZazzo wrote: >> On Sep 29, 12:44 pm, "Blubaugh, David A." <[EMAIL PROTECTED]> >> wrote: >>> Sir, >>> >>> You are absolutely correct. I was praying to G_d I did not have to >>> slaughter my project's source code in this manner. However, like life >>> itsel

Re: PYTHON WORKING WITH PERL ??

2008-10-16 Thread J Kenneth King
Joshua Kugler <[EMAIL PROTECTED]> writes: > Pat wrote: >>> Rewrite everything in python. Save yourself now...while you still >>> can. >>> >>> ~Sean >> >> Trust me. Sean is absolutely correct. I'm currently in the process of >> converting a large Perl project to Python (and learning Python at th

python extensions: including project local headers

2008-10-23 Thread J Kenneth King
#x27;]) setup(name = 'pysift', version = '0.0', description = 'A SIFT feature detection package', author = 'James Kenneth King', author_email = "[EMAIL PROTECTED]", url = "http://agentultra.com/";, long_des

Re: python extensions: including project local headers

2008-10-23 Thread J Kenneth King
Robert Kern <[EMAIL PROTECTED]> writes: > Philip Semanchuk wrote: >> >> On Oct 23, 2008, at 11:36 AM, J Kenneth King wrote: >> >>> >>> Hey everyone, >>> >>> I'm working on a python extension wrapper around Rob Hess' >

Re: python extensions: including project local headers

2008-10-23 Thread J Kenneth King
Philip Semanchuk <[EMAIL PROTECTED]> writes: > On Oct 23, 2008, at 11:36 AM, J Kenneth King wrote: > >> >> Hey everyone, >> >> I'm working on a python extension wrapper around Rob Hess' >> implementation of a SIFT feature detector. I'm wo

Re: python extensions: including project local headers

2008-10-24 Thread J Kenneth King
Philip Semanchuk <[EMAIL PROTECTED]> writes: > On Oct 23, 2008, at 3:18 PM, J Kenneth King wrote: > >> Philip Semanchuk <[EMAIL PROTECTED]> writes: >> >>> On Oct 23, 2008, at 11:36 AM, J Kenneth King wrote: >>> >>>> >>>> Hey

Re: Python suitable for Midi ?

2008-10-29 Thread J Kenneth King
Derek Martin <[EMAIL PROTECTED]> writes: > On Tue, Oct 28, 2008 at 06:54:57PM +0200, Chuckk Hubbard wrote: >> The problem I've run into is that I can't set the audio to a higher >> priority than the GUI (Tkinter). If I move the mouse over the app, no >> matter what, I get audio dropouts. AFAICT

Re: Daemon and logging - the best approach?

2008-11-07 Thread J Kenneth King
Lech Karol Pawłaszek <[EMAIL PROTECTED]> writes: > Hello. > > I'm trying to make a daemon and I want to log to a file its activity. > I'm using logging module with a configuration file for it (loaded via > fileConfig()). > > And now I want to read logging config file before daemonize the program >

Re: best python unit testing framwork

2008-11-11 Thread J Kenneth King
Brendan Miller <[EMAIL PROTECTED]> writes: > What would heavy python unit testers say is the best framework? > > I've seen a few mentions that maybe the built in unittest framework > isn't that great. I've heard a couple of good things about py.test and > nose. Are there other options? Is there an

Re: duck-type-checking?

2008-11-12 Thread J Kenneth King
Joe Strout <[EMAIL PROTECTED]> writes: > Let me preface this by saying that I think I "get" the concept of > duck- > typing. > > However, I still want to sprinkle my code with assertions that, for > example, my parameters are what they're supposed to be -- too often I > mistakenly pass in somethi

Re: Multiprocessing vs. [Pyro, RPyC]

2008-11-15 Thread J Kenneth King
Jeffrey Barish <[EMAIL PROTECTED]> writes: > [EMAIL PROTECTED] wrote: > >> >> Jeffrey> With the release of multiprocessing in Python 2.6, is there >> any Jeffrey> reason to use Pyro or RPyC? >> >> As far as I know the multiprocessing module only works on one machine >> (multi-cpu or mult

function parameter scope python 2.5.2

2008-11-20 Thread J Kenneth King
I recently encountered some interesting behaviour that looks like a bug to me, but I can't find the appropriate reference to any specifications to clarify whether it is a bug. Here's the example code to demonstrate the issue: class SomeObject(object): def __init__(self): self.words

Re: function parameter scope python 2.5.2

2008-11-20 Thread J Kenneth King
J Kenneth King <[EMAIL PROTECTED]> writes: > I recently encountered some interesting behaviour that looks like a bug > to me, but I can't find the appropriate reference to any specifications > to clarify whether it is a bug. > > Here's the example code to d

Re: function parameter scope python 2.5.2

2008-11-21 Thread J Kenneth King
alex23 <[EMAIL PROTECTED]> writes: > On Nov 21, 9:40 am, J Kenneth King <[EMAIL PROTECTED]> wrote: >> Of course, providing a shallow (or deep as necessary) copy makes it >> work, I'm curious as to why the value passed as a parameter to a >> function outside

Re: function parameter scope python 2.5.2

2008-11-21 Thread J Kenneth King
Steven D'Aprano <[EMAIL PROTECTED]> writes: > On Thu, 20 Nov 2008 18:31:12 -0500, J Kenneth King wrote: > >> Of course I expected that recursive_func() would receive a copy of >> weird_obj.words but it appears to happily modify the object. > > I am curious

Re: function parameter scope python 2.5.2

2008-11-21 Thread J Kenneth King
Peter Pearson <[EMAIL PROTECTED]> writes: > On Fri, 21 Nov 2008 10:12:08 -0500, J Kenneth King wrote: >> Steven D'Aprano <[EMAIL PROTECTED]> writes: >>> >>> I am curious why you thought that. What made you think Python should/did >>> make a c

ANN: tracshell 0.1r23

2009-03-04 Thread J Kenneth King
ho've already helped a lot by submitting patches. Bug reports, feature requests, comments and critiques are encouraged! All the best, J Kenneth King -- http://mail.python.org/mailman/listinfo/python-list

Re: While loop

2009-03-05 Thread J Kenneth King
Fab86 writes: > On Mar 5, 5:23 pm, Marco Mariani wrote: >> Fab86 wrote: >> > Is it possible to get the program to catch the exception, wait 10 >> > seconds, then carry of from where it was rather than starting again? >> >> something like this? probably works in PASCAL as well :) >> >> > i=0 >> >

Re: Roundup Issue Tracker release 1.4.7

2009-03-17 Thread J Kenneth King
Richard Jones writes: > I'm proud to release version 1.4.7 of Roundup. > - Allow CGI frontend to serve XMLRPC requests. > - Added XMLRPC actions, as well as bridging CGI actions to XMLRPC actions. Sweet. I'm working on a small project called TracShell which is a command-line front-end to the T

mocking xmlrpclib

2009-03-23 Thread J Kenneth King
At the risk of sounding like I don't know what I'm doing, I must say that I am finding it rather difficult/tedious to mock the xmlrpclib interface using minimock. I refuse to believe that I'm the only developer to have tried this before, but google isn't being my friend and I can't seem to get it

Re: HTML Generation

2009-04-03 Thread J Kenneth King
Tino Wildenhain writes: > Hi Mike, > > > Mike wrote: >> Hello all, >> >> I'm writing a web app and wanted to do some html generation (I >> really do not like to maintain or write html). >> >> I'm thinking of writing a dsl based on the following: >> >> def html(): >> return >> >> def a(): >>

Re: HTML Generation

2009-04-03 Thread J Kenneth King
Stefan Behnel writes: > J Kenneth King wrote: >> from tags import html, head, meta, title, body, div, p, a >> >> mypage = html( >> head( >> meta(attrs={'http-equiv': "Content-Type",

Re: decorators don't play nice with nose?

2009-04-06 Thread J Kenneth King
hyperboreean writes: > From: hyperboreean > Subject: decorators don't play nice with nose? > Newsgroups: comp.lang.python > To: python-list@python.org > Date: Mon, 06 Apr 2009 11:01:04 +0300 > > Hi, I am trying to test the business part of a web service. For this I > am using unittest & nose. >

unpythonic use of property()?

2009-04-17 Thread J Kenneth King
Consider: code: class MyInterface(object): def __get_id(self): return self.__id id = property(fget=__get_id) def __init__(self, id, foo): self.__id = id self.foo = foo class MyInterf

Re: unpythonic use of property()?

2009-04-20 Thread J Kenneth King
Carl Banks writes: > On Apr 17, 4:00 pm, Scott David Daniels wrote: >> Carl Banks wrote: >> > On Apr 17, 10:21 am, J Kenneth King wrote: >> >> Consider: >> >> >> code: >> >> --

Re: unpythonic use of property()?

2009-04-22 Thread J Kenneth King
Luis Zarrabeitia writes: > On Monday 20 April 2009 11:29:19 am J Kenneth King wrote: >> Changing the ID value would break things on the server, so I >> wanted to write the interface class to respect those conventions. > > Then, take this opportunity fix the server and pre

Re: unpythonic use of property()?

2009-04-22 Thread J Kenneth King
Luis Zarrabeitia writes: > On Wednesday 22 April 2009 01:44:38 pm J Kenneth King wrote: >> > Then, take this opportunity fix the server and prevent it from breaking >> > once you change the ID, because: >> >> Unfortunately it's not my server to fix. I

Re: python list handling and Lisp list handling

2009-04-26 Thread J Kenneth King
Steven D'Aprano writes: > On Sat, 25 Apr 2009 23:51:18 -0700, namekuseijin wrote: > >> On Apr 26, 1:31 am, Steven D'Aprano > cybersource.com.au> wrote: >>> On Fri, 24 Apr 2009 21:01:10 -0700, Carl Banks wrote: >>> > That's because Python lists aren't lists. >>> >>> Surely you meant to say that Li

Re: list comprehension question

2009-05-01 Thread J Kenneth King
Chris Rebert writes: > On Thu, Apr 30, 2009 at 5:56 PM, Ross wrote: >> If I have a list of tuples a = [(1,2), (3,4), (5,6)], and I want to >> return a new list of each individual element in these tuples, I can do >> it with a nested for loop but when I try to do it using the list >> comprehensio

Re: list comprehension question

2009-05-05 Thread J Kenneth King
Emile van Sebille writes: > On 5/1/2009 7:31 AM J Kenneth King said... >> Chris Rebert writes: >>> b = [] >>> for pair in a: >>> for item in pair: >>> b.append(item) >> >> This is much more clear than a nested comprehension.

Re: Any idea to emulate tail -f

2009-05-05 Thread J Kenneth King
Iain King writes: > On May 5, 7:00 am, Joel Juvenal Rivera Rivera > wrote: >> I want to make something very similar to  the command tail -f (follow a >> file), i have been trying  with some while True and some microsleeps >> (about .1 s); did someone has already

Re: list comprehension question

2009-05-06 Thread J Kenneth King
Emile van Sebille writes: > On 5/5/2009 9:15 AM J Kenneth King said... > >> List comprehensions can make a reader of your code apprehensive >> because it can read like a run-on sentence and thus be difficult to >> parse. The Python documentation discourages their use a

Re: list comprehension question

2009-05-07 Thread J Kenneth King
Steven D'Aprano writes: > On Wed, 06 May 2009 09:48:51 -0400, J Kenneth King wrote: > >> Emile van Sebille writes: >> >>> On 5/5/2009 9:15 AM J Kenneth King said... >>> >>>> List comprehensions can make a reader of your code apprehensive >

Re: Best practice for operations on streams of text

2009-05-07 Thread J Kenneth King
James writes: > Hello all, > I'm working on some NLP code - what I'm doing is passing a large > number of tokens through a number of filtering / processing steps. > > The filters take a token as input, and may or may not yield a token as > a result. For example, I might have filters which lowerca

Re: list comprehension question

2009-05-08 Thread J Kenneth King
Terry Reedy writes: > J Kenneth King wrote: >> >> Keep in mind that nested comprehensions are still available because >> they do have a use case that justifies their existence. > > Nested comprehensions are available because because the syntax makes > them ava

Re: list comprehension question

2009-05-11 Thread J Kenneth King
Steven D'Aprano writes: > On Thu, 07 May 2009 13:28:10 -0400, J Kenneth King wrote: > >> Steven D'Aprano writes: >> >>> On Wed, 06 May 2009 09:48:51 -0400, J Kenneth King wrote: >>> >>>> Emile van Sebille writes: >>>&g

Re: Annoying feedparser issues

2009-05-19 Thread J Kenneth King
John Nagle writes: > This really isn't the fault of the "feedparser" module, but it's > worth mentioning. > > I have an application which needs to read each new item from a feed > as it shows up, as efficiently as possible, because it's monitoring multiple > feeds. I want exactly one cop

Re: what I would like python.el to do (and maybe it does)

2009-05-25 Thread J Kenneth King
Giovanni Gherdovich writes: > Hello everybody, > > basically I'm writing here since I cannot > make my python.el work (a major mode for writing > python with emacs), but I would also like to share > my user experience and tell you what I think > an emacs mode should do, why do I like them > and h

Re: What text editor is everyone using for Python

2009-05-25 Thread J Kenneth King
LittleGrasshopper writes: > With so many choices, I was wondering what editor is the one you > prefer when coding Python, and why. I normally use vi, and just got > into Python, so I am looking for suitable syntax files for it, and > extra utilities. I dabbled with emacs at some point, but couldn

Re: What text editor is everyone using for Python

2009-05-26 Thread J Kenneth King
Lacrima writes: > I am new to python. > And now I am using trial version of Wing IDE. > But nobody mentioned it as a favourite editor. > So should I buy it when trial is expired or there are better choices? That is a slightly better question. Try some of the free alternatives. I do happen to u

Re: which database is suitable for small applications

2009-05-26 Thread J Kenneth King
Jean-Michel Pichavant writes: > Kalyan Chakravarthy wrote: >> Hi All, >> can any one suggest me which database I can use for my >> small application(to store user names ,passwords, very few other >> data.. ) >> I am using Python, Google Apps and guide me how to connect to >> database, I

Re: what I would like python.el to do (and maybe it does)

2009-05-29 Thread J Kenneth King
Piet van Oostrum writes: >>>>>> J Kenneth King (JKK) wrote: > >>JKK> I find that it does work, but unlike SLIME for lisp, it just imports the >>statement. > >>JKK> It confused me at first, but basically the interpreter doesn't provide >&g

Re: what I would like python.el to do (and maybe it does)

2009-06-01 Thread J Kenneth King
Piet van Oostrum writes: >>>>>> J Kenneth King (JKK) wrote: > >>JKK> Well, that's the thing -- type a statement into a python interpreter and >>JKK> you just get a new prompt. > >>JKK> LISP has a REPL, so you get some sort of feedback

Re: Python Programming Challenges for beginners?

2009-11-27 Thread J Kenneth King
astral orange <457r0...@gmail.com> writes: > Hi- > > I am reading the online tutorial along with a book I bought on Python. > I would like to test out what I know so far by solving programming > challenges. Similar to what O'Reilly Learning Perl has. I really > enjoyed the challenges at the end of

Re: Go versus Brand X

2009-11-30 Thread J Kenneth King
a...@pythoncraft.com (Aahz) writes: > Comparing Go to another computer language -- do you recognize it? > > http://www.cowlark.com/2009-11-15-go/ If you skip to the conclusion, you'll be better off. The author has an interesting point. Go (the language) is not really ground-breaking. I don't u

Re: How decoupled are the Python frameworks?

2009-12-07 Thread J Kenneth King
shocks writes: > Hi > > I'm getting back into Python after a long break. I've been developing > large enterprise apps solely with Adobe Flex (ActionScript) for the > past couple years. During that time I've used a number of 'MVC' > frameworks to glue the bits together - among them Cairngorm, a

Re: Question about 'remote objects'

2009-12-09 Thread J Kenneth King
"Frank Millman" writes: > Hi all > > I am writing a multi-user business/accounting application. It is getting > rather complex and I am looking at how to, not exactly simplify it, but find > a way to manage the complexity. > > I have realised that it is logically made up of a number of services

Re: Perl to Python conversion

2009-12-10 Thread J Kenneth King
martin.sch...@gmail.com (Martin Schöön) writes: > First off: I am new here and this is my first post after > lurking for quite some time. Hi. > Second off: I don't know much Python---yet. It's not a very big language. If you have experience programming in other languages, you can probably pick

Re: Object Relational Mappers are evil (a meditation)

2009-12-16 Thread J Kenneth King
Steven D'Aprano writes: > On Fri, 11 Dec 2009 19:20:21 -0500, Steve Holden wrote: > >> Simon Forman wrote: >> [...] >>> As far as the OP rant goes, my $0.02: bad programmers will write bad >>> code in any language, with any tool or system or environment they're >>> given. If you want to avoid b

Re: Object Relational Mappers are evil (a meditation)

2009-12-16 Thread J Kenneth King
r0g writes: > J Kenneth King wrote: >> Steven D'Aprano writes: >> >>> On Fri, 11 Dec 2009 19:20:21 -0500, Steve Holden wrote: >>> > > >>>> Hear, hear! >>> That's all very well, but some languages and techniques encourage th

Re: Object Relational Mappers are evil (a meditation)

2009-12-16 Thread J Kenneth King
Neil Cerutti writes: > On 2009-12-16, J Kenneth King wrote: >> The language doesn't encourage anything. It's just a medium >> like oil paints and canvas. A painting can be good or bad >> despite the medium it is constructed on. The skill of the >> pai

Re: Object Relational Mappers are evil (a meditation)

2009-12-21 Thread J Kenneth King
Lie Ryan writes: > On 12/17/2009 3:17 PM, J Kenneth King wrote: >> A language is a thing. It may have syntax and semantics that bias it >> towards the conventions and philosophies of its designers. But in the >> end, a language by itself would have a hard time convincin

Re: Object Relational Mappers are evil (a meditation)

2009-12-23 Thread J Kenneth King
Steven D'Aprano writes: > On Mon, 21 Dec 2009 11:44:29 -0500, J Kenneth King wrote: > >> A programmer that >> lacks critical thinking is a bad programmer. The language they use has >> no bearing on such human facilities. > > That's nonsense, and I can

Re: Object Relational Mappers are evil (a meditation)

2009-12-29 Thread J Kenneth King
Steven D'Aprano writes: > On Wed, 23 Dec 2009 10:55:19 -0500, J Kenneth King wrote: > >> Steven D'Aprano writes: >> >>> On Mon, 21 Dec 2009 11:44:29 -0500, J Kenneth King wrote: >>> >>>> A programmer that >>>> lacks cri

Re: nested structure with "internal references"

2009-09-28 Thread J Kenneth King
Hendrik van Rooyen writes: > On Friday, 25 September 2009 19:11:06 Torsten Mohr wrote: > >> I'd like to use a nested structure in memory that consists >> of dict()s and list()s, list entries can be dict()s, other list()s, >> dict entries can be list()s or other dict()s. >> >> The lists and dicts

Re: Object Relational Mappers are evil (a meditation)

2009-10-22 Thread J Kenneth King
Aaron Watters writes: > On Oct 16, 10:35 am, mario ruggier wrote: >> On Oct 5, 4:25 pm, Aaron Watters wrote: >> >> > Occasionally I fantasize about making a non-trivial change >> > to one of these programs, but I strongly resist going further >> > than that because the ORM meatgrinder makes it

Re: What IDE has good git and python support?

2009-10-28 Thread J Kenneth King
Aweks writes: > what do you use? emacs. -- http://mail.python.org/mailman/listinfo/python-list

Re: Python + twisted = Raindrop (in part)

2009-10-28 Thread J Kenneth King
Terry Reedy writes: > Rrom: > First look: inside Mozilla's Raindrop messaging platform > > http://arstechnica.com/open-source/news/2009/10/first-look-inside-mozillas-raindrop-messaging-platform.ars > > "The backend components that are responsible for retrieving and > processing messages are coded

Re: substituting list comprehensions for map()

2009-11-02 Thread J Kenneth King
Steven D'Aprano writes: > On Sun, 01 Nov 2009 23:54:16 -0800, Jon P. wrote: > >> I'd like to do: >> >> resultlist = operandlist1 + operandlist2 >> >> where for example >> >> operandlist1=[1,2,3,4,5] >> operandlist2=[5,4,3,2,1] >> >> and resultlist will become [6,6,6,6,6]. Using map(), I can

Re: substituting list comprehensions for map()

2009-11-03 Thread J Kenneth King
Ben Finney writes: > J Kenneth King writes: > >> Steven D'Aprano writes: >> >> > from operator import add >> > map(add, operandlist1, operandlist2) >> >> This is the best solution so far. > > Strange to say it's a solution, wh

Re: substituting list comprehensions for map()

2009-11-04 Thread J Kenneth King
Steven D'Aprano writes: > On Tue, 03 Nov 2009 10:22:28 -0500, J Kenneth King wrote: > >> However in this case the procedure by which we derive the value is not >> important or even interesting. It is much more succinct to think of the >> operation as a value and exp

Re: python simply not scaleable enough for google?

2009-11-12 Thread J Kenneth King
mcherm writes: > On Nov 11, 7:38 pm, Vincent Manis wrote: >> 1. The statement `Python is slow' doesn't make any sense to me. >> Python is a programming language; it is implementations that have >> speed or lack thereof. >[...] >> 2. A skilled programmer could build an implementation that com

Re: object serialization as python scripts

2009-11-16 Thread J Kenneth King
King writes: >> Why is it easier than the above mentioned - they are *there* (except the >> custom xml), and just can be used. What don't they do you want to do? >> >> Other than that, and even security issues put aside, I don't see much >> difference be

Re: python simply not scaleable enough for google?

2009-11-17 Thread J Kenneth King
David Cournapeau writes: > On Tue, Nov 17, 2009 at 10:48 PM, Aaron Watters > wrote: >> >>> I don't think Python and Go address the same set of programmer >>> desires.  For example, Go has a static type system.  Some programmers >>> find static type systems to be useless or undesirable.  Others

Re: Python/HTML integration: phileas v0.3 released

2009-11-23 Thread J Kenneth King
papa hippo writes: > On 20 nov, 09:02, Stefan Behnel wrote: >> papa hippo, 19.11.2009 19:53: >> >> > The prime goal of 'phileas' is to enable html code to be seamlessly >> > included in python code in a natural looking syntax, without resorting >> > to templatng language. >> >> I assume you know

Re: Perl conversion to python...

2009-11-23 Thread J Kenneth King
Benjamin Schollnick writes: > Folks, > > I'm having some issues here with pyserial & trying to translate a perl > script to python... It's probably my inexperience with PySerial & > perl that is troubling me... > > Can anyone assist? > > I'm concerned, since I can't seem to receive the data in a

Re: Overcoming python performance penalty for multicore CPU

2010-02-08 Thread J Kenneth King
Paul Rubin writes: > Stefan Behnel writes: >> Well, if multi-core performance is so important here, then there's a pretty >> simple thing the OP can do: switch to lxml. >> >> http://blog.ianbicking.org/2008/03/30/python-html-parser-performance/ > > Well, lxml is uses libxml2, a fast XML parser w

Re: Can someone please make it more pythonic or better?

2010-04-19 Thread J Kenneth King
Oltmans writes: > Greetings Python superstars, > > I've a directory structure like following > > tests / > __init__.py > testfile.py > > testfile.py contains following code > > import unittest > > class Calculator(unittest.TestCase): > def test_add(self): > print 'just add

Re: List of lists surprising behaviour

2010-06-17 Thread J Kenneth King
candide writes: > Let's the following code : > t=[[0]*2]*3 t > [[0, 0], [0, 0], [0, 0]] t[0][0]=1 t > [[1, 0], [1, 0], [1, 0]] > > Rather surprising, isn't it ? Not at all, actually. I'd be surprised if the multiplication operator was aware of object constructors. Even arr

Re: python interview quuestions

2010-08-10 Thread J Kenneth King
James Mills writes: > On Sat, Aug 7, 2010 at 4:32 AM, Tim Chase > wrote: >>> I would like to aquint myself with Python Interview questions >> >> This came up a while ago: >> >> http://www.mail-archive.com/python-list@python.org/msg168961.html >> >> Most of that thread is still relevant (perhaps

Re: fastest native python database?

2009-06-18 Thread J Kenneth King
per writes: > hi all, > > i'm looking for a native python package to run a very simple data > base. i was originally using cpickle with dictionaries for my problem, > but i was making dictionaries out of very large text files (around > 1000MB in size) and pickling was simply too slow. > > i am no

Re: multiprocessing: pool with blocking queue

2009-07-02 Thread J Kenneth King
masher writes: > My questions, then, is: Is there a more elegant/pythonic way of doing > what I am trying to do with the current Pool class? Forgive me, I may not fully understand what you are trying to do here (I've never really used multiprocessing all that much)... But couldn't you just assi

Re: multiprocessing: pool with blocking queue

2009-07-02 Thread J Kenneth King
masher writes: > On Jul 2, 12:06 pm, J Kenneth King wrote: >> masher writes: >> > My questions, then, is: Is there a more elegant/pythonic way of doing >> > what I am trying to do with the current Pool class? >> >> Forgive me, I may not fully understand

Re: Code that ought to run fast, but can't due to Python limitations.

2009-07-06 Thread J Kenneth King
a...@pythoncraft.com (Aahz) writes: > In article , > Hendrik van Rooyen wrote: >> >>But wait - maybe if he passes an iterator around - the equivalent of >>for char in input_stream... Still no good though, unless the next call >>to the iterator is faster than an ordinary python call. > > Calls to

Re: Python/pyobjC Apps on iPhone now a possibility?

2009-07-07 Thread J Kenneth King
Dr Mephesto writes: > I have been following the discussion about python and pyobjc on the > iphone, and it seemed to me that the app-store rules prohibited > embedded interpreters; so, python apps are a no-no. > > But now it seems that the Rubyists have the option that we don't. It > seems there

Re: Python/pyobjC Apps on iPhone now a possibility?

2009-07-07 Thread J Kenneth King
Dr Mephesto writes: > Sure, I am learning Objective C already, but the syntax is really > unfriendly after python. > > I think it really depends on the type of app you want to write. > Anything held back by network delays or that sits around waiting for > user input are perfectly acceptable targe

Re: Python/pyobjC Apps on iPhone now a possibility?

2009-07-07 Thread J Kenneth King
Stef Mientki writes: >>> So, the question is, can the same thing be done for Python apps? >>> >> >> I love Python and all, but it'd be apt to ask, what's the point? >> >> The iPhone is running on what? A 400Mhz ARM processor? Resources on the >> device are already limited; running your progr

Re: [0, 0, 0, 1, 1, 1, 0] ... remove all 0 values

2009-07-08 Thread J Kenneth King
Friðrik Már Jónsson writes: > ma wrote: >> filter(lambda x: x, your_list) > > Good call! Equivalent but more efficient: > > filter(None, your_list) > > Regards, > Friðrik Már I was wondering when someone would mention filter() -- http://mail.python.org/mailman/listinfo/python-list

Re: interactive fiction in Python?

2009-07-16 Thread J Kenneth King
George Oliver writes: > hi, I'm just curious who might be working on interactive fiction > modules in the style of Inform or TADS for Python. I've seen a few > threads on this list [1] (among many that mention IF tangentially), > and there are old projects like PUB and PAWS. There are some newer

Re: Ann: Google releases Python-based open-source NX server

2009-07-16 Thread J Kenneth King
jkn writes: > Google quietly releases open-source NX server ...written in Python, > apparently > > Google_quietly_releases_open_source_NX_server?taxonomyId=88> > > Neatx can be downloaded from Google's code repository: > >

Re: Ann: Google releases Python-based open-source NX server

2009-07-16 Thread J Kenneth King
Robert Kern writes: > On 2009-07-16 09:51, J Kenneth King wrote: >> jkn writes: >> >>> Google quietly releases open-source NX server ...written in Python, >>> apparently >>> >>> <http://www.computerworld.com/s/article/9135504/ >>&

Re: Script runs manually, but cron fails

2009-07-27 Thread J Kenneth King
Bryan writes: > I have a backup script that runs fine when I run it manually from the > command line. When I run it with cron, the script stops running at > random points in the source code. > > The script calls rsync with the subprocess module, which in turn uses > ssh to backup files from a bo

escaping characters in filenames

2009-07-29 Thread J Kenneth King
I wrote a script to process some files using another program. One thing I noticed was that both os.listdir() and os.path.walk() will return unescaped file names (ie: "My File With Spaces & Stuff" instead of "My\ File\ With\ Spaces\ \&\ Stuff"). I haven't had much success finding a module or reci

Re: escaping characters in filenames

2009-07-29 Thread J Kenneth King
Nobody writes: > On Wed, 29 Jul 2009 09:29:55 -0400, J Kenneth King wrote: > >> I wrote a script to process some files using another program. One thing >> I noticed was that both os.listdir() and os.path.walk() will return >> unescaped file names (ie: "My File Wi

Re: SQLite or files?

2009-09-17 Thread J Kenneth King
ici writes: > I like shelve for saving small amounts of data, user preferences, > recent files etc. > http://docs.python.org/library/shelve.html I like it too, but I hear the great powers that be are going to deprecate it. > > For Qt use QtCore.QCoreApplication.setOrganizationName, > QtCore.QCo

<    1   2   3   4   5