Re: Execution speed question

2008-07-25 Thread Iain King
On Jul 25, 10:57 am, Suresh Pillai <[EMAIL PROTECTED]> wrote: > I am performing simulations on networks (graphs). I have a question on > speed of execution (assuming very ample memory for now). I simplify the > details of my simulation below, as the question I ask applies more > generally than my

Re: Execution speed question

2008-07-25 Thread Iain King
On Jul 25, 1:46 pm, Iain King <[EMAIL PROTECTED]> wrote: > On Jul 25, 10:57 am, Suresh Pillai <[EMAIL PROTECTED]> wrote: > > > > > I am performing simulations on networks (graphs). I have a question on > > speed of execution (assuming very ample memory for now

Re: Execution speed question

2008-07-25 Thread Iain King
On Jul 25, 3:39 pm, Suresh Pillai <[EMAIL PROTECTED]> wrote: > That's a good comparison for the general question I posed. Thanks. > Although I do believe lists are less than ideal here and a different data > structure should be used. > > To be more specific to my case: > As mentioned in my origina

Re: Execution speed question

2008-07-25 Thread Iain King
On Jul 25, 4:22 pm, Matthew Fitzgibbons <[EMAIL PROTECTED]> wrote: > It seems like the probability calculation applies to all three equally, > and can therefore be ignored for the simulations. The probability affects (1) more. My reasoning for this being: as probability gets lower the number of

Re: Attack a sacred Python Cow

2008-07-29 Thread Iain King
On Jul 29, 5:33 am, "Russ P." <[EMAIL PROTECTED]> wrote: > On Jul 28, 8:44 pm, alex23 <[EMAIL PROTECTED]> wrote: > > > On Jul 29, 4:46 am, "Russ P." <[EMAIL PROTECTED]> wrote: > > > > As I said, I could write a pre-processor myself to > > > implement it in less than a day. > > > So WHY DON'T YOU WR

Re: Boolean tests [was Re: Attack a sacred Python Cow]

2008-07-31 Thread Iain King
On Jul 31, 7:08 am, "Russ P." <[EMAIL PROTECTED]> wrote: > On Jul 30, 10:43 pm, Erik Max Francis <[EMAIL PROTECTED]> wrote: > > > > > Russ P. wrote: > > > On Jul 30, 9:27 pm, Erik Max Francis <[EMAIL PROTECTED]> wrote: > > >> You're sure going on about a distinction without a difference for a guy >

Re: iterating "by twos"

2008-08-07 Thread shahms . king
On Jul 29, 10:36 am, kj <[EMAIL PROTECTED]> wrote: > Is there a special pythonic idiom for iterating over a list (or > tuple) two elements at a time? > > I mean, other than > > for i in range(0, len(a), 2): >     frobnicate(a[i], a[i+1]) > > ? > > I think I once saw something like > > for (x, y) in

Re: Limits of Metaprogramming

2008-08-08 Thread Iain King
On Aug 4, 5:13 pm, Tomasz Rola <[EMAIL PROTECTED]> wrote: > On Mon, 4 Aug 2008, Wilson wrote: > > " Every sufficiently large application has a poor/incomplete > > implementation ofLISPembedded within it ". > > Yep, this is either exact or very close copy of what I have read. > It's Greenspun's Ten

Re: Psyco alternative

2008-03-29 Thread king kikapu
On 28 Μαρ, 20:06, Paul Boddie <[EMAIL PROTECTED]> wrote: > On 27 Mar, 15:19, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > > > > [Psyco maintenance and further development] > > > Nope, but I heard through the grapevine that while it won't be supported for > > all times to come, a new version is i

Re: Psyco alternative

2008-03-29 Thread king kikapu
On 29 Μαρ, 16:03, Luis M. González <[EMAIL PROTECTED]> wrote: > On 27 mar, 13:14, king kikapu <[EMAIL PROTECTED]> wrote: > > > > One reason attention is going to PyPy instead of Psyco... > > > > Jean-Paul > > > I had a look at PyPy, it, indeed, have

Re: Wxpython. Is it possible to change layout in a running application? Selfmade listbox

2008-04-07 Thread Iain King
On Apr 7, 12:50 pm, Soren <[EMAIL PROTECTED]> wrote: > Hi, > > Id like to make my own special listbox.. I want to able (at the push > of a button) to add another item to my special listbox... each item is > a panel with a label, some buttons and maybe a text control. > > I've tried adding a new pan

Stani's python ide 'spe' editor problem

2008-04-09 Thread Rick King
for larger projects but limited in general. I really like spe and want to continue using it. Stani himself seems pretty unreachable. Does anyone have a clue for me about what the issue is? Is no one else using this great ide? Or is no one else having this problem? Thanks for any help

Stani's python ide 'spe' editor problem (again)

2008-04-09 Thread Rick King
In my previous post about spe I didn't mention that my set up is: python 2.4.4 wxpython 2.8.3 thanks. -Rick King -- http://mail.python.org/mailman/listinfo/python-list

Re: Pydev shell (was: Re: Stani's python ide 'spe' editor problem)

2008-04-09 Thread Rick King
I guess this is appropriate to the list... the funky things in eclipse that were happening are hard to describe, but first let me say that none of the other ide's had any funky things happening so I don't think it was my code. That said: I'm working on a command line bulk file renaming tool (us

Re: urgent question, about filesystem-files

2008-04-10 Thread Rick King
Could you first find out if it exists with isfile(..) and then try to open it? If it fails I *think* it would have to be open by another process. -Rick King Southfield MI bvidinli wrote: i started python programming a few months ago. now i need the code to understand if a file already

Re: How to make python run faster

2008-04-14 Thread king kikapu
On 14 Απρ, 16:48, 一首诗 <[EMAIL PROTECTED]> wrote: > I read this article onhttp://kortis.to/radix/python_ext/ > > And I decided to try if it's true. > > I write the program in 4 ways: > > 1. Pure C > 2. Python using C extension > 3. Python using psycho > 4. Pure Python > > And then I used timeit to t

Re: Python GUI programming and boa or better ?

2008-04-14 Thread king kikapu
On 14 Απρ, 16:20, bvidinli <[EMAIL PROTECTED]> wrote: > I program in python for about 2-3 monthos. > I just started/tested gui programming with many tools. > i tested boa last, it is the closest tool to delphi in tui tools that i used. > > I managed to play with it a bit. > > If you have any other

Splitting MainWindow Class over several modules.

2008-04-16 Thread Iain King
Until recently almost all my python programs were held 1 file for 1 program. This had grown unwieldy for one of my projects, so i decided to refactor it, and ended up with something like this: --- import wx import options import gui import scf class MainWindow(wx.Frame): def __init__(s

Re: annoying dictionary problem, non-existing keys

2008-04-24 Thread Rick King
dict also has 'get' which provides a default if the key isn't defined: a={} print a.get('a','default') default -Rick King southfield MI -- http://mail.python.org/mailman/listinfo/python-list

Subclassing datetime.date does not seem to work

2008-04-25 Thread Rick King
then this statement: d = date2('12312008') Causes: TypeError: function takes exactly 3 arguments (1 given) Is there something basically wrong with subclassing date? -Rick King -- http://mail.python.org/mailman/listinfo/python-list

Riva FLV Encoder 2.0 - FLV Converter

2008-04-26 Thread king . aftab
This robust video converter ably packs a number of file formats into the Flash video format and is stylish to boot. Riva FLV Encoder works well with the usual suspects: AVI, WMV, MPEG, and MOV files. Riva is a great freeware application for a reliable (and inexpensive) way to convert video files to

Re: gridSizer inside a panel element

2008-08-22 Thread Iain King
On Aug 22, 2:09 pm, Gandalf <[EMAIL PROTECTED]> wrote: > why when I try to insert gridSizer to a panel which already inside > another panel the gridSizer doesn't work? > > this is the code: > > panel3= wx.Panel(self, -1, (0, 60), size=(400, 240) , > style=wx.SIMPLE_BORDER); > panel3.SetBack

Re: How to update value in dictionary?

2008-08-27 Thread Iain King
On Aug 27, 2:40 pm, ssecorp <[EMAIL PROTECTED]> wrote: > dict.update({"a":1}) SETS the dict item "a" 's value to 1. > > i want to increase it by 1. isnt that possible in an easy way? I > should use a tuple for this? dict["a"] += 1 Iain -- http://mail.python.org/mailman/listinfo/python-list

Re: use of Queue

2008-08-27 Thread Iain King
On Aug 27, 1:17 pm, Alexandru Mosoi <[EMAIL PROTECTED]> wrote: > On Aug 27, 12:45 pm, Alexandru Mosoi <[EMAIL PROTECTED]> wrote: > > > > > how is Queue intended to be used? I found the following code in python > > manual, but I don't understand how to stop consumers after all items > > have been

FHA Refinance Loan

2008-09-01 Thread king . geek22
On October 1, 2008, new FHA Refinance Loan Guidelines will go into effect as part of The Housing and Economic Recovery Act of 2008. This new FHA Mortgage program is designed to help thousands of homeowners who are at risk of foreclosure in their curent conventional or sub- prime home loans. The det

wxPython GenericDirCtrl events

2006-03-08 Thread Iain King
I can't get these to work, and I can't work out what I'm doing wrong. I added the following lines to the GenericDirCtrl.py demo in the wxython demos folder: at the end TestPanel.__init__ I added: self.Bind(wx.EVT_TREE_SEL_CHANGED, self.test, dir1) and also added a test def to the class: def te

Re: wxPython GenericDirCtrl events

2006-03-08 Thread Iain King
Franz Steinhaeusler wrote: > On 8 Mar 2006 04:25:38 -0800, "Iain King" <[EMAIL PROTECTED]> wrote: > > > >at the end TestPanel.__init__ I added: > > > >self.Bind(wx.EVT_TREE_SEL_CHANGED, self.test, dir1) > >{...] > > Try this instead: >

UDP max datagram size

2006-04-12 Thread Iain King
Hi. I've been looking everywhere for this and can't find it, apologies if I'm being obtuse: How do I set the max datagram packet size? I'm using the socket module. It seem like it's hardcoded at 255, but I need it to be larger. Iain -- http://mail.python.org/mailman/listinfo/python-list

Re: UDP max datagram size

2006-04-12 Thread Iain King
Heiko Wundram wrote: > Am Mittwoch 12 April 2006 10:26 schrieb Iain King: > > Hi. I've been looking everywhere for this and can't find it, apologies > > if I'm being obtuse: How do I set the max datagram packet size? I'm > > using the socket module.

Re: Different number of matches from re.findall and re.split

2010-01-11 Thread Iain King
On Jan 11, 3:35 pm, Jeremy wrote: > Hello all, > > I am using re.split to separate some text into logical structures. > The trouble is that re.split doesn't find everything while re.findall > does; i.e.: > > > > > found = re.findall('^ 1', line, re.MULTILINE) > > len(found) >    6439 > > tables =

Re: Writing a string.ishex function

2010-01-14 Thread Iain King
On Jan 14, 3:52 pm, chandra wrote: > Folks, > > I am new to Python and could not find a function along the lines of > string.ishex in Python. There is however, a string.hexdigits constant > in the string module. I thought I would enhance the existing modlue > but am unsure how I should go about it

Re: substitution

2010-01-18 Thread Iain King
On Jan 18, 10:21 am, superpollo wrote: > superpollo ha scritto: > > > hi. > > > what is the most pythonic way to substitute substrings? > > > eg: i want to apply: > > > foo --> bar > > baz --> quux > > quuux --> foo > > > so that: > > > fooxxxbazyyyquuux --> barxxxquuxyyyfoo > > > bye > > i explai

Re: substitution

2010-01-18 Thread Iain King
On Jan 18, 12:41 pm, Iain King wrote: > On Jan 18, 10:21 am, superpollo wrote: > > > > > superpollo ha scritto: > > > > hi. > > > > what is the most pythonic way to substitute substrings? > > > > eg: i want to apply: > > > >

Re: substitution

2010-01-18 Thread Iain King
On Jan 18, 2:17 pm, Adi Eyal wrote: > > From: superpollo > > To: > > Date: Mon, 18 Jan 2010 11:15:37 +0100 > > Subject: substitution > > hi. > > > what is the most pythonic way to substitute substrings? > > > eg: i want to apply: > > > foo --> bar > > baz --> quux > > quuux --> foo > > > so that:

Re: substitution

2010-01-18 Thread Iain King
On Jan 18, 4:26 pm, Steven D'Aprano wrote: > On Mon, 18 Jan 2010 06:23:44 -0800, Iain King wrote: > > On Jan 18, 2:17 pm, Adi Eyal wrote: > [...] > >> Using regular expressions the answer is short (and sweet) > > >> mapping = { > >>  

Re: Symbols as parameters?

2010-01-21 Thread Iain King
On Jan 21, 7:43 am, Martin Drautzburg wrote: > Hello all, > > When passing parameters to a function, you sometimes need a paramter > which can only assume certain values, e.g. > >         def move (direction): >                 ... > If direction can only be "up", "down", "left" or "right", you ca

Re: substitution

2010-01-21 Thread Iain King
On Jan 21, 2:18 pm, Wilbert Berendsen wrote: > Op maandag 18 januari 2010 schreef Adi: > > > keys = [(len(key), key) for key in mapping.keys()] > > keys.sort(reverse=True) > > keys = [key for (_, key) in keys] > > > pattern = "(%s)" % "|".join(keys) > > repl = lambda x : mapping[x.group(1)] > > s

Re: Ad hoc lists vs ad hoc tuples

2010-01-27 Thread Iain King
On Jan 27, 10:20 am, Floris Bruynooghe wrote: > One thing I ofter wonder is which is better when you just need a > throwaway sequence: a list or a tuple?  E.g.: > > if foo in ['some', 'random', 'strings']: >     ... > if [bool1, bool2, boo3].count(True) != 1: >    ... > > (The last one only works

Re: Simple if-else question

2009-09-30 Thread Iain King
On Sep 30, 7:12 am, Steven D'Aprano wrote: > On Tue, 29 Sep 2009 22:29:10 -0700, John Yeung wrote: > > On Sep 29, 1:15 pm, Carl Banks wrote: > >> Hmm, I wonder if Python should emit a warning if an else is used on a > >> for block with no break inside.  I don't think the else can be invoked > >>

Re: The rap against "while True:" loops

2009-10-20 Thread Iain King
On Oct 19, 7:51 am, Hendrik van Rooyen wrote: > On Sunday, 18 October 2009 11:31:19 Paul Rubin wrote: > > > Hendrik van Rooyen writes: > > > Standard Python idiom: > > > > if key in d: > > >   d[key] += value > > > else: > > >   d[key] = value > > > The issue is that uses two lookups.  If that's

Re: why (1, 2, 3) > [1, 2, 3] is true?

2010-02-25 Thread Iain King
On Feb 25, 2:03 pm, fat bold cyclop wrote: > > Both are not equal, so the comparison returns an arbitrary result in Py2. > > Thanks, Stefan. If I understand you correctly the comparison is not > valid. > But I wonder if there is any logic behind this (in 2.x). > Is it possible to predict result of

Re: Usable street address parser in Python?

2010-04-20 Thread Iain King
On Apr 20, 8:24 am, John Yeung wrote: > My response is similar to John Roth's.  It's mainly just sympathy. ;) > > I deal with addresses a lot, and I know that a really good parser is > both rare/expensive to find and difficult to write yourself.  We have > commercial, USPS-certified products where

Re: Code redundancy

2010-04-20 Thread Iain King
On Apr 20, 2:43 pm, Alan Harris-Reid wrote: > Hi, > > During my Python (3.1) programming I often find myself having to repeat > code such as... > > class1.attr1 = 1 > class1.attr2 = 2 > class1.attr3 = 3 > class1.attr4 = 4 > etc. > > Is there any way to achieve the same result without having to rep

Re: replacing words in HTML file

2010-04-29 Thread Iain King
On Apr 29, 10:38 am, Daniel Fetchinson wrote: > > | > Any idea how I can replace words in a html file? Meaning only the > > | > content will get replace while the html tags, javascript, & css are > > | > remain untouch. > > | > > | I'm not sure what you tried and what you haven't but as a first tr

Re: GUIs - A Modest Proposal

2010-06-08 Thread David King
> My concern is simple: I think that Python is doomed to remain a minor > language unless we crack this problem. But making *another* "one true GUI library" just fragments it further. Nobody designs a GUI library intending it to suck. -- http://mail.python.org/mailman/listinfo/python-list

Re: string character count

2009-07-01 Thread Iain King
On Jun 30, 6:27 pm, noydb wrote: > If I have a string for a file name such that I want to find the number > of characters to the left of the dot, how can that be done? > > I did it this way: > x = "text12345.txt" > dot = x.find('.') > print dot > > Was curious to see what method others would use -

uniicode and executing a process with subprocess.call, or os.system

2009-07-18 Thread Rick King
;t work. I am very confused about unicode. Can someone point me in the right direction? windows xp sp2 python 2.6.2 unicode Thanks! Rick King Southfield MI -- http://mail.python.org/mailman/listinfo/python-list

Re: uniicode and executing a process with subprocess.call, or os.system

2009-07-19 Thread Rick King
Thanks. I looked around for alternatives but didn't find this one. Rick Chris Rebert wrote: On Sat, Jul 18, 2009 at 3:30 PM, Rick King wrote: Hello, I want to copy files using subprocess.call or os.system where the file names are non-ascii, e.g. Serbian(latin), c's and s's w

Re: Confessions of a Python fanboy

2009-07-31 Thread Iain King
On Jul 31, 8:28 am, Steven D'Aprano wrote: > On Thu, 30 Jul 2009 18:06:31 -0500, Robert Kern wrote: > > On 2009-07-30 16:44, r wrote: > >> On Jul 30, 4:29 pm, Emmanuel Surleau wrote: > 1.) No need to use "()" to call a function with no arguments. Python > -->  "obj.m2().m3()" --ugly > >>

Re: Confessions of a Python fanboy

2009-07-31 Thread Iain King
On Jul 31, 4:08 pm, Ethan Furman wrote: > Steven D'Aprano wrote: > > On Thu, 30 Jul 2009 18:47:04 +0100, Tim Rowe wrote: > > >>That and the fact that I couldn't stop laughing for long enough to learn > >>any more when I read in the Pragmatic Programmer's Guide that "Ruby, > >>unlike less flexible

Re: remove last 76 letters from string

2009-08-06 Thread Iain King
> print >>nucleotides, seq[-76] >      last_part = line.rstrip()[-76 : ] You all mean: seq[:-76] , right? (assuming you've already stripped any junk off the end of the string) Iain -- http://mail.python.org/mailman/listinfo/python-list

Re: remove last 76 letters from string

2009-08-06 Thread Iain King
On Aug 6, 11:34 am, MRAB wrote: > Iain King wrote: > >>      print >>nucleotides, seq[-76] > > >>      last_part = line.rstrip()[-76 : ] > > > You all mean:   seq[:-76]   , right? (assuming you've already stripped > > any junk off the end o

py2exe-created exe results in "application failed to initialize"

2009-08-07 Thread Rick King
uot;filetoolGUI.py", other_resources = [(RT_MANIFEST, 1, manifest_template % dict(prog="FileTool"))], dest_base = "FileTool") setup( options = {"py2exe": {"compressed": 1,"optimize": 2,"ascii": 1,"bundle_files": 1}}, zipfile = None, windows = [FileTool], ) Any help will be greatly appreciated! Rick King Southfield MI USA -- http://mail.python.org/mailman/listinfo/python-list

how to use "exec" stmt to get input from user

2009-08-10 Thread Rick King
so means I have to have a command window. If I add this: self.stdin = self.edt_console_input (where self.edt_console_input is a wxPython text control) it just gets an EOF right away. Is there any way to do what I want to do? This might be better posted on the wxpython list. Thanks fo

Re: how to use "exec" stmt to get input from user

2009-08-10 Thread Rick King
t how "ShowModal" is spelled in wx right now) with a text box and an Execute button and a Cancel button - if the user hits the Execute button I'd attempt to execute what he'd typed in the box. There are reasons you want to be very careful about this... On Mon, 10 Aug 2009 13:44:17

Re: Sanitising arguments to shell commands

2009-08-21 Thread Rick King
shlex doesn't handle unicode input though, so, in general, it's not a good solution. Rick King Southfield MI http://docs.python.org/library/shlex.html module shlex — Simple lexical analysis New in version 1.5.2. "The shlex class makes it easy to write lexical analyzers for

Re: easy question, how to double a variable

2009-09-24 Thread Iain King
On Sep 23, 7:36 pm, David C Ullrich wrote: > On Tue, 22 Sep 2009 02:34:53 +, Steven D'Aprano wrote: > > On Mon, 21 Sep 2009 13:50:23 -0500, David C Ullrich wrote: > > >> But you actually want to return twice the value. I don't see how to do > >> that. > > > What? > > > Seriously? > > You're sa

WMI in Python

2010-09-13 Thread KING LABS
Hi All, I am new to programming and python, Being a system administrator I have chose Inventory (Software & Hardware ) as my first project. I would like to know experts advice on the best way to build the same using python. I would like to this tool to evolve into full fledge application. I woul

Re: WMI in Python

2010-09-13 Thread KING LABS
o your RDBMS you could easily parse these logs using python and the > native db access module. > > I hope this give you a pointer. > > Sent from my iPhone 4. > > On Sep 13, 2010, at 8:45 AM, KING LABS wrote: > > > > > Hi All, > > > I am new to progra

Re: WMI in Python

2010-09-13 Thread KING LABS
On Sep 13, 8:31 pm, Jerry Hill wrote: > On Mon, Sep 13, 2010 at 8:45 AM, KING LABS wrote: > > Hi All, > > > I am new to programming and python, Being a system administrator I > > have chose Inventory (Software & Hardware ) as my first project. > > You'll

Re: WMI in Python

2010-09-13 Thread KING LABS
On Sep 14, 10:39 am, KING LABS wrote: > On Sep 13, 8:31 pm, Jerry Hill wrote: > > > On Mon, Sep 13, 2010 at 8:45 AM, KING LABS wrote: > > > Hi All, > > > > I am new to programming and python, Being a system administrator I > > > have chose Inventory

Re: WMI in Python

2010-09-16 Thread KING LABS
On Sep 16, 12:39 pm, alex23 wrote: > Lawrence D'Oliveiro wrote: > > Why not just call Scriptomatic directly from within the Python script, then? > > Because Scriptomatic _generates scripts to access WMI_, that's what it > _does_. Are you _seriously_ advocating writing Python code to fire up > a W

Re: Using nested lists and tables

2010-10-28 Thread Iain King
On Oct 28, 2:19 pm, Zeynel wrote: > On Oct 28, 4:49 am, Peter Otten <__pete...@web.de> wrote: > > Thank you this is great; but I don't know how to modify this code so > that when the user types the string 's' on the form in the app he sees > what he is typing. So, this will be in GAE. But I have a

Re: Using nested lists and tables

2010-10-28 Thread Iain King
On Oct 28, 2:35 pm, Iain King wrote: ... > (a) I don't know if the order of resolution is predicated left-to- > right in the language spec of if it's an implementation detail > (b) columns[-1].startswith('s') would be better > ... Ignore (b), I didn't read

Mailman forwarding (was: Don't feed the troll...)

2013-06-15 Thread W. Trevor King
On Sat, Jun 15, 2013 at 01:07:29PM -0400, D'Arcy J.M. Cain wrote: > On Sat, 15 Jun 2013 18:41:41 +0200 Chris “Kwpolska” Warrick wrote: > > On Sat, Jun 15, 2013 at 5:40 PM, Steven D'Aprano wrote: > > > In the name of all that's good and decent in the world, why on earth > > > would you do that when

CC etiquette for mailing lists (was: Don't feed the troll...)

2013-06-15 Thread W. Trevor King
On Sun, Jun 16, 2013 at 12:51:04AM +, Steven D'Aprano wrote: > On Sun, 16 Jun 2013 09:09:37 +1000, Chris Angelico wrote: > > Mailman is the software that runs python-list@python.org, so this > > *is* applicable to everyone who reads the mailing list (including > > myself). The fact that there'

Re: [python] email 8bit encoding

2013-07-29 Thread W. Trevor King
On Sun, Jul 28, 2013 at 04:41:27PM -0700, ru...@yahoo.com wrote: > How, using Python-3.3's email module, do I "flatten" (I think > that's the right term) a Message object to get utf-8 encoded > body with the headers: > Content-Type: text/plain; charset=UTF-8 > Content-Transfer-Encoding: 8bit > wh

Flatten an email Message with a non-ASCII body using 8bit CTE

2013-01-24 Thread W. Trevor King
Hello list! I'm trying to figure out how to flatten a MIMEText message to bytes using an 8bit Content-Transfer-Encoding in Python 3.3. Here's what I've tried so far: # -*- encoding: utf-8 -*- import email.encoders from email.charset import Charset from email.generator import BytesGenerat

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: 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: Stylistic question about inheritance

2005-04-01 Thread Guy Bolton King
"Andrew Koenig" <[EMAIL PROTECTED]> writes: > "Lonnie Princehouse" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > > > If you try this sort of inheritance, I'd recommend writing down the > > formal grammar before you start writing classes. Don't try to define > > the grammar thr

Re: parametized unittest

2014-01-11 Thread W. Trevor King
On Sat, Jan 11, 2014 at 08:00:05PM -0800, CraftyTech wrote: > I'm finding it hard to use unittest in a for loop. Perhaps something like: > > for val in range(25): > self.assertEqual(val,5,"not equal) > > The loop will break after the first failure. Anyone have a good > approach for this? ple

Re: [python] Re: GitHub's ³pull request² is proprietary lock-in

2016-01-03 Thread W. Trevor King
On Sun, Jan 03, 2016 at 04:31:55AM -0500, Random832 wrote: > But there is no command to create a "pull request", nowhere for such > a thing to exist in the repository, etc. There is this [1]. > Also if someone puts through a github pull request and then their > patch is accepted, my understanding

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

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

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

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

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: Python equivalent of Common Lisp Macros?

2008-11-26 Thread J Kenneth King
dpapathanasiou <[EMAIL PROTECTED]> writes: > I'm using the feedparser library to extract data from rss feed items. > > After I wrote this function, which returns a list of item titles, I > noticed that most item attributes would be retrieved the same way, > i.e., the function would look exactly th

Re: RELEASED Python 3.0 final

2008-12-04 Thread J Kenneth King
Barry Warsaw <[EMAIL PROTECTED]> writes: > On behalf of the Python development team and the Python community, I > am happy to announce the release of Python 3.0 final. Yay! Thanks for all the great work. -- http://mail.python.org/mailman/listinfo/python-list

Re: Python 3.0 automatic decoding of UTF16

2008-12-05 Thread J Kenneth King
Johannes Bauer <[EMAIL PROTECTED]> writes: > Traceback (most recent call last): > File "./modify.py", line 12, in > a = AddressBook("2008_11_05_Handy_Backup.txt") > File "./modify.py", line 7, in __init__ > line = f.readline() > File "/usr/local/lib/python3.0/io.py", line 1807, in r

Re: pydb 1.24

2008-12-11 Thread J Kenneth King
[EMAIL PROTECTED] (R. Bernstein) writes: > This release is to clear out some old issues. It contains some > bugfixes, document corrections, and enhancements. Tests were > revised for Python 2.6 and Python without readline installed. A bug > involving invoking from ipython was fixed. The "frame" co

Re: Are Django/Turbogears too specific?

2008-12-21 Thread J Kenneth King
Gilles Ganault writes: > Hi > > I'd like to rewrite a Web 2.0 PHP application in Python with AJAX, and > it seems like Django and Turbogears are the frameworks that have the > most momentum. > > I'd like to use this opportunity to lower the load on servers, as the > PHP application wasn't built t

Re: If your were going to program a game...

2009-01-02 Thread J Kenneth King
Tokyo Dan writes: > If your were going to program a game in python what technologies would > you use? > > The game is a board game with some piece animations, but no movement > animation...think of a chess king exploding. The game runs in a > browser in a window of a social sit

<    1   2   3   4   5   >