Re: Refactor/Rewrite Perl code in Python

2011-07-25 Thread J Kenneth King
Steven D'Aprano writes: > On Sun, Jul 24, 2011 at 7:29 PM, Shashwat Anand > wrote: > >> How do I start ? >> The idea is to rewrite module by module. >> But how to make sure code doesn't break ? > > By testing it. > > Read up on "test driven development". > > At this point, you have this: > > Per

Re: Functional style programming in python: what will you talk about if you have an hour on this topic?

2011-07-13 Thread J Kenneth King
Anthony Kong writes: > (My post did not appear in the mailing list, so this is my second try. > Apology if it ends up posted twice) > > Hi, all, > > If you have read my previous posts to the group, you probably have some idea > why I asked this question. > > I am giving a few presentations on p

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: 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: 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: 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: 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: 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-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-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-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
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: 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: 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: 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: 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: 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: 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: 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: 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: 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 between pickle and python code, except the la

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: 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: 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-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: 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: 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: 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: 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: 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

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

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: 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

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: 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: 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: [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: 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: 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
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: 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: 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: 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: 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: 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: 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: 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 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: 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 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: 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: 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: 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: 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-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: 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: 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 done something like this? >> >> A

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: 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: 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: 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: 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-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: >> >> --

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: 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. >

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: 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(): >>

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: 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

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 >> >

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: Musings: Using decorators to reduce duplicate exception handling

2009-02-19 Thread J Kenneth King
Cameron Simpson writes: > On 17Feb2009 15:12, J Kenneth King wrote: > | I recently started a project called TracShell > | (http://code.google.com/p/tracshell) where I make heavy use of the > | xmlrpclib core module. > | > | When the number of RPC calls was small, wrappin

Re: Musings: Using decorators to reduce duplicate exception handling

2009-02-18 Thread J Kenneth King
"Gabriel Genellina" writes: > En Tue, 17 Feb 2009 21:12:57 -0200, J Kenneth King > escribió: > >> I recently started a project called TracShell >> (http://code.google.com/p/tracshell) where I make heavy use of the >> xmlrpclib core module. >> >>

Musings: Using decorators to reduce duplicate exception handling

2009-02-17 Thread J Kenneth King
I recently started a project called TracShell (http://code.google.com/p/tracshell) where I make heavy use of the xmlrpclib core module. When the number of RPC calls was small, wrapping each call in try/except was acceptable. However, this obviously will duplicate code all over the place. There ar

Re: is there a project running (GUI Builder for Python ) ?

2009-02-13 Thread J Kenneth King
gc_ott...@yahoo.ca writes: > ..I come from Delphi, and compared to Delphi, even Visual Studio >> vanishes ;-) > ...I don't even notice the difference between Delphi (which > I'm still using) >> and wxPython. >> >> I think this story happened to other people to, >> so instead of putting

Re: [ANN] TracShell 0.1 released

2009-02-13 Thread J Kenneth King
J Kenneth King writes: > I tend to work a lot with Trac for project management and have always > found the browser interface to be a productivity killer. I always > wanted a simple command-line interface to Trac, but having never found > one I found a little free time and got off m

Re: is there a project running (GUI Builder for Python ) ?

2009-02-12 Thread J Kenneth King
azrael writes: > To be honest, in compare to Visual Studio, Gui Builders for wx > widgets are really bad. That's because Visual Studio is a Microsoft product to build interfaces for Microsoft products. wx on the other hand is cross platform and ergo, much more complicated. > Do you know if the

Re: TracShell 0.1 released

2009-02-12 Thread J Kenneth King
Krzysztof Retel writes: > On 12 Feb, 14:06, J Kenneth King wrote: >> I tend to work a lot with Trac for project management and have always >> found the browser interface to be a productivity killer. I always >> wanted a simple command-line interface to Trac, but having

[ANN] TracShell 0.1 released

2009-02-12 Thread J Kenneth King
I tend to work a lot with Trac for project management and have always found the browser interface to be a productivity killer. I always wanted a simple command-line interface to Trac, but having never found one I found a little free time and got off my laurels to make one. TracShell 0.1 is an ear

Re: Flattening lists

2009-02-05 Thread J Kenneth King
mk writes: > Hello everybody, > > Any better solution than this? > > def flatten(x): > res = [] > for el in x: > if isinstance(el,list): > res.extend(flatten(el)) > else: > res.append(el) > return res > > a = [1, 2, 3, [4, 5, 6], [[7, 8], [9, 10

Re: [Web 2.0] Added-value of frameworks?

2009-02-05 Thread J Kenneth King
Bruno Desthuilliers writes: > Gilles Ganault a écrit : >> Hello >> >> If I wanted to build some social web site such as Facebook, what do >> frameworks like Django or TurboGears provide over writing a site from >> scratch using Python? > > Quite a lot of abstractions and factorisation of the boil

Re: Added-value of frameworks?

2009-02-04 Thread J Kenneth King
Matimus writes: > On Feb 4, 8:08 am, Gilles Ganault wrote: >> Hello >> >> If I wanted to build some social web site such as Facebook, what do >> frameworks like Django or TurboGears provide over writing a site from >> scratch using Python? >> >> Thank you for your feedback. > > Why not just look

Re: What is wrong in my list comprehension?

2009-02-02 Thread J Kenneth King
Stephen Hansen writes: >>> str.find() returns -1 on failure (i.e. if the substring is not in the >>> given string). >>> -1 is considered boolean true by Python. >> >> That's an odd little quirk... never noticed that before. >> >> I just use regular expressions myself. >> >> Wouldn't this be somet

Re: What is wrong in my list comprehension?

2009-02-02 Thread J Kenneth King
Chris Rebert writes: > Python 2.6 (r26:66714, Nov 18 2008, 21:48:52) > [GCC 4.0.1 (Apple Inc. build 5484)] on darwin > Type "help", "copyright", "credits" or "license" for more information. bool(-1) > True > > str.find() returns -1 on failure (i.e. if the substring is not in the > given stri

Re: What is wrong in my list comprehension?

2009-02-02 Thread J Kenneth King
Chris Rebert writes: > Python 2.6 (r26:66714, Nov 18 2008, 21:48:52) > [GCC 4.0.1 (Apple Inc. build 5484)] on darwin > Type "help", "copyright", "credits" or "license" for more information. bool(-1) > True > > str.find() returns -1 on failure (i.e. if the substring is not in the > given stri

Re: What is wrong in my list comprehension?

2009-02-02 Thread J Kenneth King
Chris Rebert writes: > Python 2.6 (r26:66714, Nov 18 2008, 21:48:52) > [GCC 4.0.1 (Apple Inc. build 5484)] on darwin > Type "help", "copyright", "credits" or "license" for more information. bool(-1) > True > > str.find() returns -1 on failure (i.e. if the substring is not in the > given stri

Re: What is wrong in my list comprehension?

2009-02-02 Thread J Kenneth King
Chris Rebert writes: > Python 2.6 (r26:66714, Nov 18 2008, 21:48:52) > [GCC 4.0.1 (Apple Inc. build 5484)] on darwin > Type "help", "copyright", "credits" or "license" for more information. bool(-1) > True > > str.find() returns -1 on failure (i.e. if the substring is not in the > given stri

Re: Recommendation for a small web framework like Perl's CGI::Application to run as CGI?

2009-01-29 Thread J Kenneth King
excord80 writes: > I need to make a small, relatively low-traffic site that users can > create accounts on and log into. Scripts must run as cgi (no > mod_python or FastCGI is available). Can anyone recommend a small and > simple web framework for Python, maybe similar to Perl's > CGI::Applicatio

Re: I'm a python addict !

2009-01-26 Thread J Kenneth King
J Kenneth King writes: > Linuxguy123 writes: > >> I just started using python last week and I'm addicted. >> >> I hate Perl. I never did learn to use it with any competence. I has to >> be the most obfuscated, cryptic language I've ever seen. Maki

Re: I'm a python addict !

2009-01-26 Thread J Kenneth King
Linuxguy123 writes: > I just started using python last week and I'm addicted. > > I hate Perl. I never did learn to use it with any competence. I has to > be the most obfuscated, cryptic language I've ever seen. Making it > "object oriented" only makes it worse ! > .. .. I program full-time

Re: Pyro deadlock

2009-01-20 Thread J Kenneth King
MatthewS writes: > I'd like to know if the following behavior is expected and can be > avoided: I have a Pyro server object that maintains a queue of work, > and multiple Pyro worker objects that take work off the queue by > calling a method on the server (get_work) and then return the work to >

Re: Two questions about style and some simple math

2009-01-20 Thread J Kenneth King
Spoofy writes: > .. .. > > 2. > > For maintaining the character attributes I creates a seperate class. I > wonder weather this is an "overuse" of OO (instead of just making the > attributes plain variables of the Char class) and if the way I wrote > this is OK (somehow this looks cool to me but

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: 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-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-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-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: 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: 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: 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

  1   2   >